fix(runtime): keep delegation under CoreRoom control#397
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the release-blocking delegation/cost issue found during v0.9.17 dogfood and prepares v0.9.18.
Root cause: managed Claude Code roles had access to Claude Code's native
Agenttool. That created a second delegation plane inside the@hostsession: work was host-intended, but not CoreRoom-dispatched, so it bypassed CoreRoom parent turns, lifecycle cards, per-role cost attribution, interrupts, and tracker evidence.Changes
Agentdelegation for managed roles with--disallowedTools Agent.Agentin the CoreRoom Claude permission hook, even if session policy tries to allow it.@role: <brief>.total_cost_usdsamples into per-role/session deltas forcr cost.@host spawningfooter/card noise.COREROOM_MOUSE_CAPTURE=1.Evidence
Real dogfood log showed 17 Claude native
Agentcalls in.coreroom/messages.jsonl, including reviewer audits and implementer worktrees. Examples included@frontend implements #379 demo,@engineer implements #380 lifecycle data model,@frontend implements #381/#382/#384/#386, and reviewer audits for PRs #388-#392.Those tasks were legitimate delegation/review/implementation work, but the execution mechanism was wrong: they were Claude-native Agent tool calls inside
@host, not CoreRoomTurnDispatchedchild turns. Earlier in the same log, normal@frontend:CoreRoom delegation did emitTurnDispatched role=frontend parent=..., proving the CoreRoom route existed and worked.Corrected
cr cost --since 2026-05-26on the dogfood log now reports:Raw pre-normalization host sum from the same log was
411.3542, confirming previous overcount from cumulative Claude Code session samples.Validation
cargo fmt --all -- --checkgit diff --checkenv -u NO_COLOR TERM=xterm-256color cargo test --quietcargo clippy --all-targets --all-features -- -D warningscargo build --locked --quietnpm pack --dry-run --jsonfromnpm/reports@spytensor/coreroom@0.9.18env -u NO_COLOR TERM=xterm-256color cargo run --quiet -- cost --project /Users/zhuchaojie/Desktop/codes/CoreRoom --since 2026-05-26Release Plan
After merge to
main, tag and pushv0.9.18frommain. The existing release workflow builds GitHub release assets and publishes npm whenNPM_PUBLISH_ENABLEDis true.Risks / Rollback
Risk: users who expected Claude Code native Agent inside CoreRoom roles will now be forced through CoreRoom
@rolerouting. That is intentional for host-led control. Rollback is a revert of this PR before tagging v0.9.18.