Repository navigation
fix(core): enforce subagent_depth for subtask commands - #135
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
The following comment was made by an LLM, it may be inaccurate: |
Fixes #127
Problem
The
subagenttool refuses to launch once a session isexperimental.subagent_depthlevels below its top-level session (and a limit of 0 disables subagents entirely), but a command configured to run as a subagent (subagent: true/ legacysubtask: true, or an agent with modesubagent) skipped that check entirely inpackages/core/src/config/plugin/command.tsand created the child session directly. Withsubagent_depth: 0such a command still created a subagent session; at the limit it created one level deeper.Solution
SubagentDepth.assertWithinLimit(packages/core/src/session/subagent-depth.ts): cycle-guarded, limit checked inside the walk and for a top-level session, returns the caller's depth, fails withSubagentDepth.LimitErrorcarrying the same messages as the tool (including namingexperimental.subagent_depth).ToolFailureas before, with noerrorpayload sotoSessionErrorkeepstool.execution).Command.ExecutionErrorwith the depth-limit message.Tests
packages/core/test/config/command-subagent.test.ts: refused withsubagent_depth: 0from a top-level session, refused in a session already at the limit (depth 1), and still runs below the limit. The two refusal tests fail on unmodified main (the command succeeded and created a child) and pass with the fix.command-subagent.test.ts70/70 under--rerun-each 10;tool-subagent.test.ts(incl. cycle, self-parent, configured-limit and zero-limit regressions) 45/45 under--rerun-each 3; core typecheck exit 0; prettier and oxlint clean on touched files.Single-repo: the subagent_depth walk and subtask commands exist only in this repo.
Local push used
--no-verifyper the established sandbox precedent (husky pre-push full-repo check exceeds sandbox memory); GitHub CI is the gate.Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit