You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent-tools): let a parent stop its child after its grant shrinks - #4673
A parent agent can always stop a child it started, even after its grant shrinks: the switch goes to look-only (view), the depth is lowered, or the child's harness is removed from "Agents they may call". agent_stop now needs only a valid run token and ownership of the child, not the start/send grant. Revocation (off), ownership and a person's hold still apply. Learned from T3 Code issue #40175 (stop gated by a permission-escalation check).
Part E of the owner-approved delegation convenience package (2026-11-25).
Tests
New server/agent-tools/stop.contract.test.ts: the three shrink cases each answered not_granted on main and stop the child after the fix; the owner routes POST /api/pane/turn/cancel and cancel-children work with the setting off (already true, now pinned).
server/agent-tools/hub.test.ts: the view-level test no longer expects stop to be not_granted; it now reaches the target check (behaviour changed on purpose).
Validation
bun run check fast: typecheck, build, generated files ok; unit 27941 pass, 2 fail: server/ssh-account-add.test.ts and scripts/plugin-tui.test.ts, the same environment failures this machine shows on other branches (long TMPDIR socket path, .env HOME fallback), unrelated to this diff.
Auto incremental reviews are disabled on this repository.
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.
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
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
A parent agent can stop a child it started even after its delegation permissions are reduced.
A driving device can cancel child work through agent tools when those tools are turned off.
Documentation
Clarified when parent agents and driving devices can stop or cancel child work.
The agent tool hub now permits a run to stop its own child after delegation permissions are reduced. Tests cover policy changes and cancellation requests when agent tools are disabled.
Changes: Delegated child stopping
Layer / File(s)
Summary
Stop authorization and policy-change coverage server/agent-tools/hub.ts, server/agent-tools/hub.test.ts, server/agent-tools/stop.contract.test.ts
The hub includes stop in scope when a run started a child and allows that authenticated stop action even if the run’s verbs omit it. Tests cover authorization checks and child stopping after policy changes.
Cancellation with tools disabled server/agent-tools/stop.contract.test.ts, docs/harness-tool.md, changelog.d/delegation-stop-after-grant-change.md
Tests check cancel and cancel-children requests with agent tools disabled. The documentation and changelog describe stopping a child after grant reduction and cancelling through agent tools.
devswha/ovis#4624: Adds the settings and grant model for agent harness tool levels and ACP child ownership.
devswha/ovis#4603: Introduces the agent harness tool, including its run-only verbs, stop behavior, and cancellation routes.
Merge Risk: Minimal · previous review e6d4f
This change lets a parent agent stop a child it started after its delegation permissions are reduced. Revocation and ownership checks still apply. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main behavior change: a parent can stop its child after its delegation grant shrinks. It matches the hub.ts stop-permission change and the new stop tests. It is specific and single…
Description check
The description follows the template. It has a Change section that explains the problem, the resulting behavior, and the linked issue (T3 Code #40175). It has a Validation section that lists the comma…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main behavior change: a parent can stop its child after its delegation grant shrinks. It matches the hub.ts stop-permission change and the new stop tests. It is specific and single-sentence, and it uses the conventional fix(scope) prefix.
Full details: Description check
Explanation
The description follows the template. It has a Change section that explains the problem, the resulting behavior, and the linked issue (T3 Code #40175). It has a Validation section that lists the commands run, their results, and the two unrelated failing tests. It does not explicitly confirm HTTP/WS contract-test coverage in words, but the Tests section describes the contract tests for the owner cancel routes, so the requirement is substantially met.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between 355248f and e6d4fd4.
Files selected for processing: 5
changelog.d/delegation-stop-after-grant-change.md
docs/harness-tool.md
server/agent-tools/hub.test.ts
server/agent-tools/hub.ts
server/agent-tools/stop.contract.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.
Merged through pr-merge at head c636afddf. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.
Owner approved the convenience package (2026-11-25). CodeRabbit did not review this head (limit). Reviews: omo gate reviewer (BLOCK: stop refused while the child waits on an approval card, reproduced with a real keeper; docs LOW) and Codex gpt-6.2-sol-fast xhigh adversarial review (CLEAR; CI skip MEDIUM, docs LOW); all fixed in the keeper-cancel commit plus the CI test list and its pinned expectation. Follow-up: #4677 (bulk stop misses an opening child).
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
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.
What
A parent agent can always stop a child it started, even after its grant shrinks: the switch goes to look-only (
view), the depth is lowered, or the child's harness is removed from "Agents they may call".agent_stopnow needs only a valid run token and ownership of the child, not the start/send grant. Revocation (off), ownership and a person's hold still apply. Learned from T3 Code issue #40175 (stop gated by a permission-escalation check).Part E of the owner-approved delegation convenience package (2026-11-25).
Tests
server/agent-tools/stop.contract.test.ts: the three shrink cases each answerednot_grantedon main and stop the child after the fix; the owner routesPOST /api/pane/turn/cancelandcancel-childrenwork with the settingoff(already true, now pinned).server/agent-tools/hub.test.ts: the view-level test no longer expectsstopto benot_granted; it now reaches the target check (behaviour changed on purpose).Validation
bun run check fast: typecheck, build, generated files ok; unit 27941 pass, 2 fail:server/ssh-account-add.test.tsandscripts/plugin-tui.test.ts, the same environment failures this machine shows on other branches (long TMPDIR socket path, .env HOME fallback), unrelated to this diff.