fix: enforce focus subagent scope#73613
Conversation
Greptile SummaryThis PR fixes a security boundary gap where The previously flagged concern about the runs-based resolution path bypassing the new Confidence Score: 5/5Safe to merge — the fix correctly enforces the subagent control-scope boundary on /focus, matching the enforcement already present on other subagent-control commands. No P0 or P1 findings. The runs-based path that was flagged in a prior review is already scoped by No files require special attention. Reviews (2): Last reviewed commit: "docs: add changelog for focus scope fix" | Re-trigger Greptile |
41f78e6 to
60d2719
Compare
|
Codex review: needs maintainer review before merge. What this changes: The PR branch adds a Maintainer follow-up before merge: This is an open security-hardening implementation PR with a protected label and pending/relevant review context, so the next action is maintainer/security review rather than an automated replacement or cleanup close. Best possible solution: Land a reviewed fix that applies the same subagent control-scope boundary to Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against b92d14525262. |
60d2719 to
b174822
Compare
b174822 to
d4c02ae
Compare
|
@greptile review |
|
To use Codex here, create a Codex account and connect to github. |
* fix: enforce focus subagent scope * docs: add changelog for focus scope fix
* fix: enforce focus subagent scope * docs: add changelog for focus scope fix
fix: enforce focus subagent scope
Summary
/focuscould resolve and bind a target session before applying the subagent control-scope boundary used by other subagent-control commands./focusnow resolves the requester controller, rejects leaf subagent callers, and passes a requester key into fallback target resolution so gateway resolution is restricted to child sessions for subagent callers.Change Type (select all)
Scope (select all touched areas)
Gateway / orchestration
Skills / tool execution
Auth / tokens
Memory / storage
Integrations
API / contracts- Related NVIDIA-dev/openclaw-tracking#525
UI / DX
CI/CD / infra
Linked Issue/PR
Root Cause (if applicable)
/focushandler did not callresolveCommandSubagentControllerbefore target resolution and binding, and fallback gateway target resolution omitted the requester'sspawnedByvisibility filter.Regression Test Plan (if applicable)
src/auto-reply/reply/commands-subagents-focus.test.tsandsrc/auto-reply/reply/commands-subagents-shared-focus.test.ts/focusrequests are rejected before binding, and subagent fallback target resolution passesspawnedBy.User-visible / Behavior Changes
Leaf subagents can no longer use
/focusto bind conversations to other sessions.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) YesYes/No) YesYes, explain risk + mitigation: The/focuscommand now rejects leaf subagent control attempts and narrows fallback target resolution for subagent callers. This reduces session-control and conversation-routing scope.Repro + Verification
Environment
Steps
/focusand shared focus target resolution./focusrejects before target resolution and binding.spawnedBy.Expected
Actual
pnpm exec vitest run --config test/vitest/vitest.auto-reply-reply.config.ts src/auto-reply/reply/commands-subagents-focus.test.ts src/auto-reply/reply/commands-subagents-shared-focus.test.ts --reporter=verbosepassed.Evidence
Attach at least one:
Focused validation after the fix:
Human Verification (required)
What you personally verified (not just CI), and how:
spawnedBypropagation in fallback resolution.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations