Skip to content

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

Merged
tejaskash merged 6 commits into
refactorfrom
feat/dev-supervisor
Aug 25, 2026
Merged

feat(dev): supervise every runtime in project dev#2041
tejaskash merged 6 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
@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.79518% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.37%. Comparing base (e51a676) to head (ec9377c).
⚠️ Report is 1 commits behind head on refactor.

Files with missing lines Patch % Lines
src/handlers/project/dev/index.ts 95.94% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           refactor    #2041    +/-   ##
==========================================
  Coverage     97.36%   97.37%            
==========================================
  Files           424      425     +1     
  Lines         25571    25761   +190     
==========================================
+ Hits          24897    25084   +187     
- Misses          674      677     +3     

☔ 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
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch 2 times, most recently from 7b4b60b to 0ca91f0 Compare August 24, 2026 16:13
@Hweinstock

Copy link
Copy Markdown
Contributor

agentcore project dev without --agent runs all of the project's runtimes at once.

Is this the behavior on the publicly released CLI? I thought we always had to select one?

@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch 2 times, most recently from fc5db62 to 9904ee1 Compare August 24, 2026 21:51
@notgitika
notgitika self-requested a review August 24, 2026 22:14
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 9904ee1 to 0a77c0c Compare August 25, 2026 15:06
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.
…batch

events() spliced the queue, yielded each event, then installed its wake
callback and blocked. A push landing during the yields ran while wake was
undefined, so its wake was a no-op, and the newly installed waiter never
noticed the queued event until the next push or shutdown. Re-check the queue
inside the wait so a queued event resolves immediately.
@tejaskash
tejaskash force-pushed the feat/dev-supervisor branch from 175d896 to abf8c23 Compare August 25, 2026 19:39
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels Aug 25, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Aug 25, 2026
…s review

Remove the runSingleRuntime special case so every runtime, one or many,
runs through DevSupervisor. Start all agents concurrently and stream their
output live rather than awaiting each readiness first. End the event loop
when no agent is starting or running, and exit non-zero when none started.

Make start() async so an unknown name rejects rather than throwing
synchronously. Time readiness off the agent's last output (idle timeout)
so a slow build that keeps logging is not killed. Move waitForPort into
src/io/port.ts to keep socket IO in the IO layer. Rename the environment
accessor to getDevEnvVarsForRuntime and SupervisedEvent.agent to agentName.
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels Aug 25, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot added claude-security-reviewing Claude Code /security-review in progress and removed claude-security-reviewing Claude Code /security-review in progress labels Aug 25, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Aug 25, 2026
@tejaskash
tejaskash requested review from jariy17 and notgitika August 25, 2026 19:48
Split renderEvent into renderAgentEvent (agent name required) and
renderStatus for command-level trace-collector lines, so agent output
is always tagged with [name] and the agent-optional branches are gone.

Addresses review feedback on #2041.
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels Aug 25, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Aug 25, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Aug 25, 2026
@tejaskash
tejaskash merged commit 1d96d1f into refactor Aug 25, 2026
22 of 23 checks passed
@tejaskash
tejaskash deleted the feat/dev-supervisor branch August 25, 2026 20:25
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.

5 participants