Skip to content

refactor(dev): unify local development supervision - #67

Closed
Hweinstock wants to merge 4 commits into
refactorfrom
fix/dev-supervisor-refactor
Closed

Hweinstock wants to merge 4 commits into
refactorfrom
fix/dev-supervisor-refactor

Conversation

@Hweinstock

@Hweinstock Hweinstock commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Description

Local development duplicates cancellation and runtime lifecycle handling between a selected headless agent and supervised agents. Use the shared cancellation helper and DevSupervisor across modes while preserving output, readiness, error, and cleanup behavior. Keep changes focused on unifying the execution paths. The refactor removes more lines than it adds. Existing test cases remain intact; only three expected error values change to match the supervisor's Error representation.

Solution, by commit:

  • Share SIGINT/SIGTERM cancellation handling and the shutdown message.
  • Unify runtime supervision while retaining original error objects and the Inspector's error-message contract.
  • Preserve existing startup, readiness, exit, and buffered-output behavior.
  • Remove unrelated supervisor hardening and cosmetic edits.

Related Issue

Related to aws#1690 and aws#257: preserve cleanup and surfaced startup errors during refactoring.

Documentation PR

Not applicable; commands, flags, and configuration remain unchanged.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe): Refactor; net reduction of 17 lines (+228/-245)

Testing

  • I ran bun test
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them

Verification:

  • bun test: 3,977 passed, zero failures; no test cases added or removed.
  • Typecheck, lint, formatting, secrets scan, and repository-configured bun run audit passed.
  • Node bundle and Linux binary built; node dist/index.js --help passed.
  • Compiled CLI local smoke checks passed for single-agent human/JSON output, multi-agent invocation, SIGINT/SIGTERM cleanup, and startup failures.
  • Successful selected-agent exits preserved all 100 output lines in human and JSON modes.

Example compiled CLI evidence:

> ./dist/bin/agentcore-linux-x64 dev --mode headless --no-traces --region us-west-2
> curl --silent --show-error --fail -H 'Content-Type: application/json' -d '{"prompt":"hello"}' http://127.0.0.1:9000/invocations
{"agent": "Orders", "prompt": "hello"}
> curl --silent --show-error --fail -H 'Content-Type: application/json' -d '{"prompt":"hello"}' http://127.0.0.1:9001/invocations
{"agent": "Billing", "prompt": "hello"}
SIGTERM: exit 130; both runtime ports released

The live AWS deployment E2E suite was not run: AWS requests and deployment paths are unchanged. Existing tests and real compiled CLI local invocations verify the affected behavior.

Spec

  • Share cancellation handling and use DevSupervisor across local-development modes.
  • Preserve selection, ports, environment, traces, human/JSON output, errors, readiness, and interrupt exit code 130.
  • Await pending startup on cancellation and drain buffered output before closing the trace collector.
  • Limit changes to those needed to unify the execution paths.
  • Add no test cases; retain only necessary adaptations of existing error expectations.
  • Produce a negative net line diff against refactor.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

No new tests were added: the existing cases remain, with three error expectations adapted for the refactored representation.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@Hweinstock
Hweinstock force-pushed the fix/dev-supervisor-refactor branch from 80026c8 to 8d7e659 Compare October 7, 2026 14:40
@Hweinstock Hweinstock closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant