Repository navigation
fix: allow session tools in system continuations - #187105
Conversation
Resolve trusted system turns through the existing current-principal authority owner, and revalidate principal ownership and grants before effects. Remove restart-specific resolution and prior-person grants from ordinary transcript continuations while preserving scheduled authority.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19dc2f358e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sessionId: operation.sessionId, | ||
| storePath: params.defaults.storePath, | ||
| resolveGatewayContext: params.defaults.resolveGatewayContext, | ||
| assertCurrent: assertOperationCurrent, |
There was a problem hiding this comment.
Separate retained principal authority from the admitting operation
When a system continuation spawns a child or yields to a tool handoff, its accepted work must outlive the admitting reply operation. However, prepareSessionPrincipalRunAccess retains this assertCurrent callback inside the principal authority, and assertOperationCurrent throws as soon as operation.result is set. Both child admission and captureOperatorToolGatewayContinuationContext retain that same authority; independentContinuation cannot detach this callback. Consequently, a child loses authority when its parent finishes, and a github_publish handoff—which explicitly waits for operation.ownerSettlement before executing—fails its authority check after yielding. Use the operation check during admission without permanently binding accepted continuation authority to that operation, while retaining current principal, role, and session checks.
AGENTS.md reference: AGENTS.md:L97-L97
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. What this changesSystem continuations resolve the session’s current human principal instead of inheriting the previous caller’s authority. Example: A background command completes in agent:main:resume-principal and requests sessions_spawn.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 8 items remain Keep open: this maintainer-authored PR addresses a concrete continuation failure, but retained authority expires with the admitting reply and affected consumer checks fail. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherHost events, transcript follow-ups, and internal agent requests enter session admission, which resolves current principal and session access before supplying authority to agent tools and accepted work. flowchart TD
A[Host event or transcript followup] --> B[Session admission]
B --> C[Current session principal]
C --> D[Existing role and session authorization]
D --> E[Admitted tool authority]
E --> F[Child launch or tool handoff]
D --> G[Current authority checks]
Technical reviewBest possible solution: Resolve current principals through the existing authorization owner while keeping admission liveness separate from independently retained work authority. Do we have a high-confidence way to reproduce the issue? Source establishes missing person authority on ordinary system admission and the introduced retained-lifetime failure; no target code was executed during this read-only review. Is this the best way to solve the issue? Sharing the existing principal resolver is appropriate, but its retained authority must not permanently capture the admitting reply’s completion check. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a58b82fa970a. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete privilege bypass was established, but the changed system-to-human authority boundary requires final-effect isolation evidence. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +209, Tests -6, Docs +7. Total +210 across 27 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 28, 2026, 8:20 PM ET / October 29, 2026, 00:20 UTC. |
Reverts #187105 (d821a7f). It merged over six failed CI jobs, including a privilege-boundary regression: a guest-started background exec completion continued with the session principal's authority and lost the guest's AutoReview policy. The four failing test files pass locally on this revert head (99 tests).
|
Reverted in #187126 (5be92b4). This merged while exact-head CI had six failed jobs, which my merge step should have caught. One failure is a privilege-boundary regression. In |
…ity (openclaw#187105) Turns started by the system (background exec completion events, transcript continuations, goal continuations, synthetic system RPC) now act with the session principal's current authority. That principal is the assigned owner, or else the human profile creator, and authority is revalidated at the point of effect. These turns had no participants, so person-scoped tools like sessions_spawn refused with "User is not a participant of this turn" (8 refusals on the Team server since 10-02; 4 in the real-model stress run on main). The agent silently stopped work as soon as it continued from an event instead of a fresh message. - One resolver (prepareSessionSystemTurnAuthority -> prepareSessionPrincipalRunAuthority, sessionPrincipal) shared with restart resume; no per-trigger special cases. - An explicit non-human assignment never falls back to a former human creator. Sessions without a human principal gain no person authority, and their refusal now says so ("This turn has no person authority. A person must resume this work..."). - Cron keeps its own authority model. Proof: the exec-completion regression is red on base. A second child launch is refused after principal demotion at effect. 177 focused tests pass at the PR head (prompt-prefix stability included). The touched suites (113 tests) pass locally on current main merged with this head. No CI job failed. Merged at the pinned head per Peter's local-proof merge rule.
Reverts openclaw#187105 (60e218e). It merged over six failed CI jobs, including a privilege-boundary regression: a guest-started background exec completion continued with the session principal's authority and lost the guest's AutoReview policy. The four failing test files pass locally on this revert head (99 tests).
#187346) System-started turns now continue with the current authority of whoever started the work they continue. Before, they had no person authority: person-scoped tools like sessions_spawn refused with "User is not a participant of this turn" (8 Team-server refusals since 10-02; 4 in real-model stress on main), and the agent silently stopped work as soon as it continued from an event. - A guest's background exec, subagent or goal continues as that guest, keeping the guest's current policy (AutoReview etc.), revalidated at the point of effect. - Only system work with no originating caller (restart resume, unattributed events) falls back to the session principal's current authority. An explicit non-human assignment never falls back to a former human creator; no-principal turns get no person authority and an honest refusal. - Node exec completions keep the captured logical target and agent; the prefixed queue key is used only for storage and cleanup. - Cron keeps its own authority model. This redoes #187105, which was reverted in #187126 after it continued a guest-started background completion with owner authority (lost the guest's AutoReview). Proof at exact head b16e958: - The exec-completion sessions_spawn regression is red on base; guest-continuation, revocation and delayed-node custody tests pass; the node-owner regression is red on dc07bd4 and green here. - Locally, 21 files (430 tests) and ten static checks pass, including zero-cycle guards. - Exact-head CI: 93 jobs passed. The single failed job, checks-node-changed-compact-large-23, is sessions-create-thinking-claim.test.ts "...at the same timestamp (delivered-event)". It passed on both previous heads (dc07bd4, 425cbfb), the only change since is the unrelated 4-line node-owner fix, and it passed 6/6 locally on this head, so it is a timing intermittent.
openclaw#187346) System-started turns now continue with the current authority of whoever started the work they continue. Before, they had no person authority: person-scoped tools like sessions_spawn refused with "User is not a participant of this turn" (8 Team-server refusals since 10-02; 4 in real-model stress on main), and the agent silently stopped work as soon as it continued from an event. - A guest's background exec, subagent or goal continues as that guest, keeping the guest's current policy (AutoReview etc.), revalidated at the point of effect. - Only system work with no originating caller (restart resume, unattributed events) falls back to the session principal's current authority. An explicit non-human assignment never falls back to a former human creator; no-principal turns get no person authority and an honest refusal. - Node exec completions keep the captured logical target and agent; the prefixed queue key is used only for storage and cleanup. - Cron keeps its own authority model. This redoes openclaw#187105, which was reverted in openclaw#187126 after it continued a guest-started background completion with owner authority (lost the guest's AutoReview). Proof at exact head b16e958: - The exec-completion sessions_spawn regression is red on base; guest-continuation, revocation and delayed-node custody tests pass; the node-owner regression is red on dc07bd4 and green here. - Locally, 21 files (430 tests) and ten static checks pass, including zero-cycle guards. - Exact-head CI: 93 jobs passed. The single failed job, checks-node-changed-compact-large-23, is sessions-create-thinking-claim.test.ts "...at the same timestamp (delivered-event)". It passed on both previous heads (dc07bd4, 425cbfb), the only change since is the unrelated 4-line node-owner fix, and it passed 6/6 locally on this head, so it is a timing intermittent.
Related: #185730
What Problem This Solves
Fixes person-scoped session tools refusing authorized system continuations after background command completion.
User Impact
System-triggered turns can spawn and continue work using the session principal's current authority, without another user message. Revocation or ownership changes still prevent later effects. Scheduled jobs keep their existing authority model.
Why This Change Was Made
The restart redesign resolved principal authority for restart input, but other system admissions still depended on the previous turn's caller or had no person authority. Trusted host inputs now share the existing principal resolver at admission, selecting the assigned human owner or verified human creator and checking current grants before effects. Public provenance alone cannot select this path. This removes the restart-specific resolver and inherited person grants from ordinary transcript continuations.
Sessions without a human principal gain no person authority; their refusal now explains that a person must resume the work. There are no configuration, dependency, schema, or persisted-shape changes.
Evidence
The exec-completion regression fails on the base and passes with the fix through real event admission and the managed
sessions_spawntool, omittinguser. Its second child launch is refused after the principal is demoted at the effect boundary. Only model decisions and the final child launch are synthetic; no live Gateway or real user state was used.Local proof passed with
nice -n 5and at most eight Vitest workers: 177 tests across nine focused files, followed by 29 passing tests in the two files with final fixture corrections. The existing operator-run cancellation suite also passed all 15 tests. Core typecheck, the three affected test type graphs, targeted lint, formatting of all 27 changed files, andgit diff --checkpassed. Prompt-prefix stability is included in the 177-test run.The final exec regression was replayed on the base with production changes temporarily reversed: event execution started but principal authority was absent, and the test failed. Production edits were restored and the final principal suite passed all seven tests.
The complete change is production +429/−220 (net +209), tests +161/−167 (net −6), and docs +7. Necessary growth covers shared admission, current-owner validation and release ownership; no limit or baseline was raised. Codex autoreview found no actionable P0–P2 findings in the final snapshot. The local ClawSweeper checkout was unavailable, so the documented autoreview route was used.