Skip to content

feat(dev): supervise every runtime in project dev - #2041

Open
tejaskash wants to merge 3 commits into
refactorfrom
feat/dev-supervisor
Open

feat(dev): supervise every runtime in project dev#2041
tejaskash wants to merge 3 commits into
refactorfrom
feat/dev-supervisor

Conversation

@tejaskash

@tejaskash tejaskash commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review after #1980

What this does

agentcore project dev without --agent runs all of the project's runtimes at once. Each agent's output is attributed ([orders] ... in the terminal, an agent field in NDJSON); one agent crashing reports its failure and leaves the others running; Ctrl-C tears the whole set down. Selecting one runtime (--agent, or a single-runtime project) keeps the direct path where a crash fails the command — scripts and CI rely on that exit code.

How

DevSupervisor (core/dev/supervisor.ts) owns per-agent lifecycle: an abort scope per agent chained to the command signal, a per-agent state machine (idle/starting/running/failed) with start dedup, TCP readiness probing, and one merged attributed event stream. It's also what the Inspector UI slice (next PR) drives via its start-on-demand API. Ports resolve sequentially — concurrent resolution raced two HTTP agents onto the same port.

Verification

  • Supervisor: state machine, dedup, retry-after-failure, merge, crash isolation, abort chaining.
  • Handler with fake runners + fake collector, including runners that bind real TCP listeners so the readiness probe runs for real.
  • End to end: built the bundle, scaffolded a project, added a second runtime to agentcore.json, ran project dev — both agents started on distinct ports with attributed logs, both answered real Bedrock invocations, and the trace directory holds spans for both service names (per-runtime OTEL_SERVICE_NAME verified end to end). SIGTERM exits 130.

tsc/lint/format clean.

@github-actions github-actions Bot added the size/l PR size: L label Aug 19, 2026
@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 19, 2026
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 1864da4 to c539836 Compare August 19, 2026 19:51
@tejaskash

tejaskash commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Both addressed:

  • Unbounded poll — waitForPort has a 120s deadline now; a never-binding child fails with a clear message instead of blocking. Tested dead + live ports.
  • Leaked abort listeners — early setup failures unchain the parent-abort listener like every other exit path. Tested across three failed retries.

@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.24%. Comparing base (f38b18d) to head (7b4b60b).

Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2041      +/-   ##
============================================
+ Coverage     97.22%   97.24%   +0.02%     
============================================
  Files           391      392       +1     
  Lines         23677    23894     +217     
============================================
+ Hits          23019    23236     +217     
  Misses          658      658              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from c539836 to 6080aa0 Compare August 20, 2026 16:09
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 6080aa0 to 82af18a Compare August 20, 2026 16:18
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 82af18a to 2db7743 Compare August 21, 2026 15:23
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 2db7743 to 136a454 Compare August 21, 2026 16:14
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 136a454 to 35775f9 Compare August 21, 2026 17:51
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 35775f9 to a9f11fe Compare August 21, 2026 18:55
Base automatically changed from feat/dev-otel-collector to refactor August 21, 2026 21:32
project dev without --agent now runs all of the project's runtimes at once:
a DevSupervisor owns per-agent lifecycle (sequential port resolution — a
concurrent race would put two agents on one port), merges every runner's
output into one agent-attributed stream ([name] prefixes; an agent field in
NDJSON), and keeps the session alive when one agent crashes. Selecting a
single runtime (--agent, or a one-runtime project) keeps the direct path
where a crash still fails the command.
…setup

A child that stays alive without ever binding its port previously blocked
every later runtime (starts are sequential) until interrupted; readiness now
gives up after 120s and fails that start. Setup failures before the pump
exists (port resolution, environment) now remove their parent-abort listener
like every other exit path, so Inspector retries of a failing agent cannot
accumulate listeners.
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from a9f11fe to 4ad026c Compare August 21, 2026 21:32
The #1980 rebase carried a single-runtime host check (runtime.build) into
the multi-agent dev handler, where the variable is the runtimes array. Bind
all interfaces when any selected runtime runs in a container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants