Skip to content

fix(gateway): stop input effects after caller authority closes - #150640

Merged
roboclaw-bot merged 2 commits into
openclaw:mainfrom
roboclaw-bot:fix/pr135838-input-authority
Sep 26, 2026
Merged

roboclaw-bot merged 2 commits into
openclaw:mainfrom
roboclaw-bot:fix/pr135838-input-authority

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #135838

Additional instructions

Allow edits from maintainers remains enabled.

What Problem This Solves

Fixes an issue where users cancelling or replacing a delegated request could still see a session reset, queued input, saved media or a reset confirmation. Also fixes retries that repeated a completed reset or incorrectly reported success after confirmation delivery failed, and old request cleanup overwriting a newer request’s status.

Why This Change Was Made

Compose the existing caller/session guards with canonical reservation ownership across preaccept effects, interruption, cleanup and lifecycle rotation; release caller-admission assertions only when input synchronously transfers to the accepted child. Retain the original reset and reply outcomes without repeating effects, while preserving client-authority forwarding, operator cancellation, sessionless/recovery/settle-wake paths and existing test coverage; remove duplicated first-key cleanup/interruption policy.

Production: +156/-60 (net +96); tests/support: +1862/-26. Production growth supplies previously missing live authority and all-key ownership checks plus committed-reset/error reconciliation across existing owners; no second store, fallback execution path or cached authorization is added.

User Impact

  • No new RPC field, client/provider version cutoff, plugin SDK signature, configuration, protocol or database-schema change. Valid ordinary and delegated callers keep their supported interfaces.
  • Closed or superseded callers cannot obtain new input or confirmation-send admission. A reset already adopted by its lifecycle owner may finish; that does not authorize a fresh suffix or ACK. Already-accepted input retains independent child custody.
  • Retry behavior also affects ordinary callers. A same-key retry does not repeat an already-committed reset. If strict confirmation delivery fails—including a write followed by an uncertain error—the retry preserves the original failed RPC outcome rather than reporting success or sending again. Best-effort requests retain their original delivery-status result.
  • An unstarted suffix must be submitted separately. A reset-only receipt is not channel-delivery proof. The existing process-local dedupe window remains bounded to five minutes / 1,000 entries; this is not durable cross-restart exactly-once behavior.

Contributor credit: @sallyom and @vincentkoc.

Work sessions

Evidence

Normal-hook source f36be495d0330fd3377e6f6c33caa4fe2d21cc14, parent 8ccaaaae043181a9a7861ef4b4c8ad1dfe614351, tree bdb45af3662396a775f060f44e625c014acfc6c1. The downloaded artifact, ZIP digest, bundle, parent/tree/patch, bot author and both exact human trailers were independently verified.

  • New baseline regression: 8 genuine assertion failures + 15 passing controls, all 23 cases executed. No import/setup/hook/type/timeout failure counted as a negative. Baseline and fixed proof-file/support bytes match.
  • Fixed verification: 669 passed across 15 files—all 23 proof cells, 599 sibling cases, and 47 further sibling cases. Formatting, typed lint and all four ratchets passed.
  • Types: fresh core plus all 25 canonical changed-path-selected consumer graphs passed.
  • Fresh build: literal build of the new bdb45af tree passed. It is not reused v1 evidence or the skipped public build.
  • Fresh whole-candidate independent review through P2: two passes, no remaining actionable findings. Earlier findings were repaired; historical failed runs remain failed.
  • The original authority baseline on main baseline 8be6c5a separately demonstrated eight failures/six controls. It is not conflated with the new 8ccaaaae baseline above.

Final integration gates passed on source f36be495d0330fd3377e6f6c33caa4fe2d21cc14. Public CI 36255123412 succeeded: 122 passed / 23 skipped jobs; required openclaw/ci-gate, CodeQL, Critical Quality, OpenGrep and Security Review are green. Actual Gateway job passed all 23 authority cases within 1,096 tests / 92 files on synthetic merge 40367b7c52f33f140febee0740e070f10ac1d47a (base be46e6966c2b52c6cde06abf965c44f9a175a47f, tree 37afd232b1fb20a8ba3e9337d19f10df508671bd). This is separate public composition proof, not relabeled private source-tree proof. Public build-artifacts was skipped; the fresh private literal build above remains the build evidence.

Fresh ClawSweeper review, revision 3 on exact f36be495, has no actionable findings or before-merge items; prior retry/cost requests are addressed. Latest main 88816f79b42c0a85f9ecd1d99593d50554807092 also composes conflict-free; subsequent owner-neighborhood drift was inspected. Native guarded preparation passed on the same source head. Landing is authorized through the repository-native guarded flow, without a freshness-only rebase or bypass.

Observed behavior and measured proof cost
Boundary Repaired observation
Caller closes before reset adoption Row/transcript unchanged; rejected
Reset already committed/adopted Durable completion retained; no unauthorized fresh suffix/ACK
Input/media preparation loses authority No queued input/dispatch; unowned prepared media removed
Accepted child custody Input can persist after the parent closes
Native Stop or replacement before final send Zero late sends; newer outcome/reservation preserved
Replacement during post-reset SQL wait No input row committed
Interruption/revalidation with a newer alias owner Only the old admission’s owned keys change
Strict or ambiguous send failure Original error replayed; one reset and one delivery attempt total
Best-effort failure Original failed delivery-status result preserved

The 23 cells comprise 19 registered-RPC/effect cases and four real admission/cache/lease interruption controls, sharing the suite-level Gateway fixture. SQLite, transcript, media, authority owners and native Stop are real. Inference and a filesystem recording channel adapter are synthetic boundaries—not authenticated external-channel, provider, worker, ACP or Codex runtime proof.

Explicit one-worker measurement: resource receipts confirm one selected file and effective maxWorkers=1. Fixed proof: 67.45 s full-process wall, 66.88 s repository-wrapper wall, 62.110 s native run elapsed, 9.474 s module tests/lifecycle duration, and 4.042 s summed printed case durations. Native collection—including transform waits—was 50.583 s; setup was 0.646 s. These distinct measurements are not interchangeable.

FULL consumed 945 CI job-seconds, including checkout/setup; the complete validation recipe was 574 s. TYPES: 1,772 job-seconds; BUILD: 1,607 job-seconds; RED: 502 job-seconds. These are observed durations, not billing estimates or a controlled speedup claim. The fixture intentionally pays real Gateway/SQLite initialization once to cover final effects that the former mocked proof missed. No coverage was removed to reduce cost.

Build warnings: TypeScript experimental-API notices and the existing startup-CSS advisory with 1,036 bytes of hard-ceiling headroom. No baseline was raised; no causal CSS delta is claimed for this Gateway-only repair.

Named follow-up — F-RESET-POSTCOMMIT-NOTIFY: existing reset postcommit notifications/ACP metadata can precede the producer callback; incognito deletion has a separate unbinding path. A failure before that callback can withhold the committed fact. Those injected-failure paths were not proven or repaired here; this PR does not claim every possible postcommit failure is covered.


View the OpenClaw team session

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 12:30 PM ET / 16:30 UTC (Revision 3).

ClawSweeper review

What this changes

The branch checks live caller and request ownership before Gateway agent resets, input writes, media persistence, and reset confirmations, while preserving committed reset and delivery outcomes for retries.

Merge readiness

✅ Ready for maintainer review

Current main still lacks the Gateway checks needed for this fix. The latest head addresses the earlier retry finding, and the supplied production-path proof covers the main authority and delivery cases. Keep the protected PR open for normal review and merge gates.

Priority: P2
Reviewed head: f36be495d0330fd3377e6f6c33caa4fe2d21cc14

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong boundary proof and a focused follow-up repair support a good patch rating; the sizable test surface remains a normal review consideration.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The branch's registered agent RPC proof uses a real Gateway context, session storage, and final delivery owner with injected caller revocation, Stop, replacement, and send faults; the captured after-fix result reports denied late effects and preserved retry outcomes. The recording channel adapter is synthetic, and the linked run logs could not be independently reopened. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The branch's registered agent RPC proof uses a real Gateway context, session storage, and final delivery owner with injected caller revocation, Stop, replacement, and send faults; the captured after-fix result reports denied late effects and preserved retry outcomes. The recording channel adapter is synthetic, and the linked run logs could not be independently reopened. No stored-data contract changes.
Evidence reviewed 9 items PR introduction: The pinned merge-base-to-head diff adds live request ownership checks to the existing Gateway agent path.
Current-main gap: Current main passes a caller guard into the agent service but does not compose the existing agent-runtime authority guard at the registered RPC handler.
Current-main cleanup gap: Current-main cleanup checks the first available dedupe entry and can then delete every request key; the branch checks ownership per key.
Findings None None.
Security None None.

How this fits together

The Gateway accepts agent requests and prepares session input before an agent run starts. It records session changes and may send a reset confirmation through the outbound delivery system.

flowchart LR
  A[Agent request] --> B[Caller authority]
  B --> C[Request reservation]
  C --> D{Still current?}
  D -->|Yes| E[Reset or stage input]
  D -->|No| F[Reject new effects]
  E --> G[Record outcome]
  G --> H[Reply or confirmation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +96, Tests +1836. Total +1932 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 9 156 60 +96
Tests 5 1862 26 +1836
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 2018 86 +1932

Review metrics

Metric Value Why it matters
Production and proof growth production net +96; tests and support net +1836 The PR body explains the production growth as composing existing owners and gives measured cost for the larger proof suite.
Authority proof cases 23 cases: 19 registered-RPC effects, 4 admission controls The cases exercise allowed and revoked callers at the changed effect boundaries.

Technical review

Best possible solution:

Keep one Gateway-owned live-authority check through reset adoption, input commit, and final delivery, with retry replay preserving the original committed outcome.

Do we have a high-confidence way to reproduce the issue?

Yes: registered agent RPC cases can revoke or replace a delegated caller while reset, input, or delivery is pending. I did not execute them on fetched current main; its source still shows the missing checks.

Is this the best way to solve the issue?

Yes. The branch composes the existing runtime-authority, reservation, storage, and delivery owners instead of introducing a parallel authority store or interface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against be46e6966c2b.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The fix addresses consequential but bounded Gateway reset and input behavior for cancelled or replaced requests.
  • merge-risk: 🚨 compatibility: The branch changes replay results for existing reset requests, including ordinary callers whose confirmation delivery failed.
  • merge-risk: 🚨 message-delivery: The final confirmation-send guard and retry outcome can affect whether a reset acknowledgment is sent or repeated.
  • merge-risk: 🚨 security-boundary: The changed path decides whether a delegated caller retains authority to cause session and outbound effects.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The branch's registered agent RPC proof uses a real Gateway context, session storage, and final delivery owner with injected caller revocation, Stop, replacement, and send faults; the captured after-fix result reports denied late effects and preserved retry outcomes. The recording channel adapter is synthetic, and the linked run logs could not be independently reopened. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The branch's registered agent RPC proof uses a real Gateway context, session storage, and final delivery owner with injected caller revocation, Stop, replacement, and send faults; the captured after-fix result reports denied late effects and preserved retry outcomes. The recording channel adapter is synthetic, and the linked run logs could not be independently reopened. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-17T05:54:23.455Z sha 3a60dfe :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-26T15:10:27.760Z sha 8ccaaaa :: blocked before merge. :: [P1] Preserve failed delivery on cached reset retries

Preserve current caller and accepted-input custody, retain committed reset receipts, and prove the real authority boundaries.

Co-authored-by: sallyom <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the fix/pr135838-input-authority branch from 3a60dfe to 8ccaaaa Compare September 26, 2026 15:01
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 26, 2026
Preserve committed reset idempotency without converting failed confirmation delivery into successful retry responses.

Co-authored-by: sallyom <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 26, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Final land-ready verification — Gateway input authority

Reviewed source: f36be49. No blocking findings. Best fix: compose the existing caller/admission/reservation owners before effects; record failed confirmation outcomes at their producer. Accepted-child custody remains independent. First-key interruption/cleanup policy is removed, not supplemented with a second authority store or retry path. Production +156/-60 (net +96); tests/support +1862/-26. Growth supplies the missing effect fences and committed-outcome reconciliation.

Proof: eight genuine baseline assertion failures, fifteen passing controls; then all 23 boundary cases plus 646 sibling cases pass. Fresh core, all 25 selected type graphs and a literal build pass. Runs: RED, FULL, TYPES, BUILD. Final independent autoreview: two scoped-clean passes, no actionable findings.

Public integration: CI 36255123412 is green, 122 successful / 23 skipped jobs. Required ci-gate and security checks passed. Gateway job 108440890712 actually executes all 23 authority cases within 1,096 passing tests / 92 files on merge 40367b7c (be46 + f36), including strict/ambiguous retry and accepted-custody controls. Raw log hash and checkout identity verified. Public build-artifacts was skipped—not a fresh build. Latest main 88816f7 also composes conflict-free; no material candidate-owner incompatibility found.

Latest ClawSweeper review: no findings, Before merge: None, no new Rank-up moves. Prior strict-retry repair and explicit one-worker cost request are addressed. Serial process wall: 67.45 s; FULL job: 945 s—not a billing estimate or controlled speedup. Native review validation and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 150640 passed on unchanged f36.

Executed commands, contracts and limits

Pinned CI recipes ran git diff --check "$BASE_SHA" HEAD; node scripts/check-changed.mjs --base "$BASE_SHA" --head HEAD --dry-run; changed-file oxfmt --check; node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json on changed TypeScript; line-cap, max-lines, assertion-safety and env-var ratchets. Serial proof command:

/usr/bin/time -f 'PR150640_PROOF wall_s=%e user_s=%U sys_s=%S maxrss_kib=%M exit=%x' env OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/gateway/server.agent-runtime-authority-proof.test.ts --maxWorkers=1 --reporter=verbose --reporter=github-actions --reporter=./scripts/lib/vitest-resource-reporter.mts
pnpm tsgo:core
node scripts/run-tsgo-core-test-shards.mjs --changed-paths-json "$changed_json"
pnpm build

Sibling pnpm test invocations covered user-turn, agent RPC/reset, local-operator authority, internal facade, wait/dedupe, dispatch owner/SQLite/legacy, abort currentness, late admission, execution ownership and task tracking. Local source operations were static Git inspection/composition, artifact verification, independent source review and native guarded preparation; the full validation above ran remotely.

Personally checked upstream Codex at e766f7598993ce37cf61b9c26c80cc2ba3a4f2d7, codex-rs/core/src/tools/parallel.rs:125–220. Native cancellation does not supply host mutation authority. No live Codex/provider/ACP claim.

SQLite/transcript/media and Gateway authority owners are real; inference and recording channel adapter are synthetic. Process-local dedupe remains five minutes / 1,000 entries, not durable exactly-once. The pre-existing F-RESET-POSTCOMMIT-NOTIFY callback/notification gap stays named in the PR body, not claimed repaired. This lands the input-authority slice of #135838, not that entire batch.

@roboclaw-bot
roboclaw-bot merged commit 1844d93 into openclaw:main Sep 26, 2026
219 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the fix/pr135838-input-authority branch September 26, 2026 16:54
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…law#150640)

Preserve live caller and reservation ownership across Gateway reset, input, media and confirmation effects. Keep committed reset outcomes and strict-delivery errors truthful on retry without repeating effects or overwriting newer reservations.

Related: openclaw#135838. This lands the input-authority slice, not the entire remaining replacement batch.

Verification: 23 owner/effect cases plus 646 sibling cases; fresh core and 25 consumer type graphs; fresh build. Baseline demonstrates eight genuine assertion failures with fifteen controls. Final public checks and native guarded landing gates are required on the same source head.

Work session: https://team.openclaw.ai/chat/roboclaw/dashboard/70f8933b-db6b-4809-b9a8-941957263614

Co-authored-by: sallyom <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants