Skip to content

fix(gateway): preserve queued abort metadata - #166269

Open
RomneyDa wants to merge 1 commit into
mainfrom
fix/frv-auth-timeout-metadata
Open

RomneyDa wants to merge 1 commit into
mainfrom
fix/frv-auth-timeout-metadata

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Problem

Full Release Validation reproduced an agent cancellation race twice in the real release shard. sessions.abort can publish its supplemental dedupe timeout before the admitted agent execution publishes the terminal result. That supplemental agent payload omitted timeoutPhase and providerStarted, so callers observed an incomplete queue-timeout result.

Solution

Use the canonical aborted-agent payload builder for the sessions.abort agent fallback while preserving the existing chat payload. The fallback now reports timeoutPhase: "queue" and providerStarted: false consistently with the agent execution owner.

Evidence

Repair against current main ba6d94ec17712:

  • Current RPC source owner now exposes execution start through getRpcSourceStartedAt; the agent-only queued guard uses the retained exact aborted source. Running agents and chat keep the existing receipt shape.
  • Added a queued-agent cancellation regression through the actual sessions.abort handler: red on unmodified main (both queue metadata fields absent), green on this repair.
  • Full receipt-currentness suite passed 7/7, covering queued cancellation, running-agent negative metadata, successor preservation, residual exec cancellation, and rotated source identity. Final Vitest run 82.41s (96.62s with harness).
  • Touched-file lint/formatter and git diff --check passed.
  • Local ClawSweeper reviewed ba6d94ec17712..61ef1b752b257: no actionable correctness/security findings.
  • Current-head hosted CI is tracked separately; previous-head CI/typechecks are not reused as current proof.

Original FRV failure: https://github.com/openclaw/openclaw/actions/runs/37518320382/job/112457505051

@clawsweeper

clawsweeper Bot commented Oct 6, 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.

@RomneyDa RomneyDa added the ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. label Oct 6, 2026
@RomneyDa

RomneyDa commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 automerge status

ClawSweeper finished this automerge repair pass without changing the branch.

Executor outcome: validation command failed (pnpm check:changed): $ node scripts/check-changed.mjs --timed [check:changed] lanes=core, coreTests [check:changed] src/gateway/server-methods/sessions-abort.ts: core production [check:changed] src/gateway/server-methods/sessions.....
Worker summary: Make this PR merge-ready for ClawSweeper automerge. Rebase onto latest main, address PR comments and review findings, fix CI/check failures, preserve release-note context, and validate before returning.

Worker actions:

  • build_fix_artifact on this PR: planned - Maintainer opted this PR into ClawSweeper automerge/autofix repair; run the direct Codex edit loop after live hydration instead of a separate read-only planning pass.

No push, rebase, replacement PR, merge, or ClawSweeper re-review happened on this pass.

fish notes: reasoning medium; reviewed against 72c26ed.

Automerge progress:

  • 2026-10-11 05:20:40 UTC merge check queued 72c26edb8a4a (GitHub checks failed: security-fast:FAILURE, openclaw/ci-gate:FAILURE)
  • 2026-10-11 09:37:13 UTC review queued 72c26edb8a4a (queued)
  • 2026-10-11 10:12:41 UTC merge check queued 72c26edb8a4a (GitHub checks failed: security-fast:FAILURE, openclaw/ci-gate:FAILURE)

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 6, 2026
@clawsweeper clawsweeper Bot added clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 Oct 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed. Reviewed October 6, 2026, 4:45 PM ET / 20:45 UTC (Revision 3).

ClawSweeper review

What this changes

The PR adds queue-timeout metadata to cancellation receipts for agent runs that have not started execution while preserving running-agent and chat receipts.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on current main. No actionable introduced defect remains, and the earlier running-agent metadata finding is resolved.

Priority: P2
Reviewed head: 72c26edb8a4a8e7dc6a342392c3092ae07e82a1e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with meaningful receipt-currentness coverage and no remaining correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored PR is exempt from ordinary contributor runtime proof; no material authority change triggers additional proof. Reported focused tests are supplemental, and the in-memory receipt change introduces no stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from ordinary contributor runtime proof; no material authority change triggers additional proof. Reported focused tests are supplemental, and the in-memory receipt change introduces no stored-data contract.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head diff reuses the existing aborted-agent payload builder only when the captured run is an agent with executionStarted explicitly false. Existing receipt currentness checks, chat payloads, and running-agent payloads remain intact.
Execution-phase contract: Controller registration initializes executionStarted to false; markExecutionStarted changes the same controller entry to true and refuses an aborted or retired registration. The execution owner already publishes timeoutPhase queue and providerStarted false for undispatched cancellation through the shared payload builder.
Regression coverage: The complete four-case receipt-currentness test starts execution, pauses after actual transcript persistence, and checks unchanged, absent, and successor receipts. Added assertions ensure running-agent cancellation does not acquire queue metadata.
Findings None None.
Security None None.

How this fits together

Gateway session cancellation stops admitted runs and publishes cached results for RPC callers. Those results feed agent wait and replay responses, which distinguish queued cancellation from execution that already started.

flowchart TD
 A[Session cancellation request] --> B[Authorized abort handler]
 B --> C[Captured run and receipt]
 C --> D{Agent execution started?}
 D -->|No| E[Canonical queue cancellation result]
 D -->|Yes or chat| F[Existing cancellation result]
 E --> G[Cached RPC result]
 F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +10, Tests +2. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 8 +10
Tests 1 2 0 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 20 8 +12

Review metrics

None.

Technical review

Best possible solution:

Keep cancellation receipt metadata aligned with the execution owner's canonical result while retaining existing running-agent and chat semantics.

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

Yes, from source: cancel an admitted, undispatched agent before its execution owner publishes the terminal result, and the current-main supplemental receipt omits queue metadata. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the existing payload builder under the explicit undispatched-agent guard is a narrow repair that preserves running-agent and chat behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 660556970ac3.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a focused correction to cancellation-result metadata with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Not applicable: The member-authored PR is exempt from ordinary contributor runtime proof; no material authority change triggers additional proof. Reported focused tests are supplemental, and the in-memory receipt change introduces no stored-data contract.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff reuses the existing aborted-agent payload builder only when the captured run is an agent with executionStarted explicitly false. Existing receipt currentness checks, chat payloads, and running-agent payloads remain intact. (src/gateway/server-methods/sessions-abort.ts:661, 72c26edb8a4a)
  • Execution-phase contract: Controller registration initializes executionStarted to false; markExecutionStarted changes the same controller entry to true and refuses an aborted or retired registration. The execution owner already publishes timeoutPhase queue and providerStarted false for undispatched cancellation through the shared payload builder. (src/gateway/chat-abort.ts:195, 72c26edb8a4a)
  • Regression coverage: The complete four-case receipt-currentness test starts execution, pauses after actual transcript persistence, and checks unchanged, absent, and successor receipts. Added assertions ensure running-agent cancellation does not acquire queue metadata. (src/gateway/server-methods/sessions.abort-dedupe-currentness.test.ts:155, 72c26edb8a4a)
  • Re-review continuity: GitHub's exact previous-head-to-current-head comparison shows only optional access on capturedRun.executionStarted. The previous completed review had no findings; the earlier queue-metadata restriction remains present. (src/gateway/server-methods/sessions-abort.ts:661, 72c26edb8a4a)
  • Current-main necessity: The pinned fetched-main source still publishes the supplemental timeout payload without timeoutPhase or providerStarted. This repair is therefore still useful. (src/gateway/server-methods/sessions-abort.ts:657, 660556970ac3)
  • Latest-release comparison: The v2026.9.8 source also retains the old supplemental timeout payload. No shipped implementation of this repair was established. (src/gateway/server-methods/sessions-abort.ts:664, fc23bc864e45)

Likely related people:

  • steipete: 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-10-06T20:10:25.568Z sha a7358d9 :: blocked before merge. :: [P2] Restrict queue metadata to undispatched agent cancellations
  • reviewed 2026-10-06T20:33:40.958Z sha 9ebbaa6 :: passed. :: none

@RomneyDa

RomneyDa commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 6, 2026
@RomneyDa

RomneyDa commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa force-pushed the fix/frv-auth-timeout-metadata branch from 72c26ed to 61ef1b7 Compare November 25, 2026 20:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant