Skip to content

Navigation Menu

Sign in
Sign up

feat(orchestrator): real ClaudeAgentHarness via the Claude Agent SDK — P1b-iv (7/7) - #1123

Draft
najmuzzaman-mohammad wants to merge 1 commit into
deepagents/06-orchestrator-e2e from
deepagents/07-claude-agent-harness
Draft

feat(orchestrator): real ClaudeAgentHarness via the Claude Agent SDK — P1b-iv (7/7) #1123
najmuzzaman-mohammad wants to merge 1 commit into
deepagents/06-orchestrator-e2e from
deepagents/07-claude-agent-harness

Conversation

@najmuzzaman-mohammad

@najmuzzaman-mohammad najmuzzaman-mohammad commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Real inner harness — P1b-iv (7/7 in stack)

Makes the inner-execution seam real: ClaudeAgentHarness drives Claude Code for
one turn via the Claude Agent SDK, wired to teammcp. This completes the
single-task path (§5b) — the orchestrator now drives an actual Claude turn
instead of FakeHarness.

Renumbered from "P2" → P1b-iv to avoid colliding with the migration plan's
P2 (the CEO decompose node). Same work we discussed; clearer place in the plan.

The heart of it: a pure classifier

The turn outcome is decided by classify_outcome — a pure function keyed on the
agent's real team_task actions (grounded in the broker's vocabulary):
complete/done→completed, submit_for_review→review, block→blocked,
planning-without-a-terminal-action→plan_ready, else continue. Claude Code
namespaces MCP tools as mcp__<server>__team_task, so the classifier matches the
tool-name suffix. No prose parsing. This keeps the policy fully unit-tested
without a key or the SDK installed — only the thin SDK glue (build options, run
query, collect transcript) is lazy + pragma: no cover.

Secrets stay names-only

Env-var names arrive on the wire (McpServer.env_passthrough) and are
resolved to values here from the orchestrator's own environment — same trust
model as internal/provider/claude.go. Tested: granted names resolve, unset →
"", ungranted vars never appear.

Degrade-safe

build_harness returns FakeHarness when the SDK is absent, so the service
stays runnable key-free and existing tests are unchanged. This also closes the
P1b-iii FakeHarness gap
— the real harness returns a real gate state instead of
re-projecting running.

Verify

cd orchestrator && .venv/bin/pytest -q # 43 green, no SDK/key needed
bash scripts/smoke.sh # still SMOKE OK (degrades to FakeHarness)

Live agent run needs pip install claude-agent-sdk + a model key.

Base: deepagents/06-orchestrator-e2e (PR #1122).

🤖 Generated with Claude Code

...(P1b-iv)
Makes the inner-execution seam real: ClaudeAgentHarness drives Claude Code for
one turn via the Claude Agent SDK, wired to teammcp. Env-var NAMES arrive on the
wire (McpServer.env_passthrough) and are resolved to values HERE from the
orchestrator's own environment, never on the wire — same trust model as
internal/provider/claude.go.
The intellectual content is a PURE outcome classifier: classify_outcome keys on
the agent's real team_task actions (grounded in the broker's vocabulary —
complete/done -> completed, submit_for_review -> review, block -> blocked,
planning-without-a-terminal-action -> plan_ready, else continue). Claude Code
namespaces MCP tools as mcp__<server>__team_task, so the classifier matches the
tool-name suffix. This keeps the policy fully unit-tested without a model key or
the SDK installed; only the thin SDK glue (build options, run query, collect
transcript) is lazy + pragma-no-cover.
build_harness degrades to FakeHarness when the SDK is absent, so the service
stays runnable key-free and existing tests are unchanged. This also closes the
P1b-iii FakeHarness gap: the real harness returns a real gate state instead of
re-projecting running.
Renumbered from 'P2' to P1b-iv to avoid colliding with the migration plan's P2
(the CEO decompose node); this work completes the single-task §5b seam.
- classify_outcome + TurnTranscript/ToolCall (pure, 11 cases incl. priority +
 mcp-prefix matching + non-team_task action ignored).
- _mcp_servers_config resolves env names from a provided env (value present,
 unset -> , ungranted vars absent).
- run_turn fails loud with install guidance when the SDK is absent (CI path).
- _prompt_for / _permission_mode_for (planning -> read-only 'plan').
- 43 pytest green; live smoke still SMOKE OK (degrades to FakeHarness).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 629878a0-e399-4953-937a-f0287d1d0ac0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deepagents/07-claude-agent-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /