Skip to content

fix(gateway): keep accepted runs alive across config reloads - #163174

Merged
RomneyDa merged 1 commit into
release/2026.9.8from
fix/release-2026.9.8-channel-drain
Oct 2, 2026
Merged

RomneyDa merged 1 commit into
release/2026.9.8from
fix/release-2026.9.8-channel-drain

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 2, 2026

Copy link
Copy Markdown
Member

Related: #160909

What Problem This Solves

Fixes: accepted Matrix and Telegram work is cancelled when a release-validation scenario hot-reloads Gateway configuration.

User Impact

User impact: runs accepted before an unrelated config reload can finish, while revoked identities, origins, methods, and shared credentials still lose authority immediately.

Why This Change Was Made

This backports the existing main authority split between transport fencing and admitted-principal grants to release/2026.9.8. It also carries the fixed startup auth mode through proxy-policy classification and local fallback-password revocation, covering an override edge case found during backport review.

Evidence

  • Source failure: Full Release Validation run 36926596622, whose Matrix scenarios repeatedly failed with Async work scope is closed immediately after config reload; the Telegram policy hot-reload scenario timed out on the same boundary.
  • Focused Gateway tests: 96 passed across shared-auth generation, identity-scope reload, session creation, config-write shared auth, WebSocket origin policy, and mutation-authority suites.
  • Added/updated shared-auth generation suite: 14/14 passed in 44.14s (pnpm test src/gateway/server-shared-auth-generation.test.ts --maxWorkers=1).
  • pnpm tsgo:core and pnpm tsgo:core:test passed.
  • Targeted Oxlint, formatting, and git diff --check passed.
  • check-changed --staged --base origin/release/2026.9.8 passed its changed-scope checks until the repository's pre-existing 11 expired plugin-boundary compatibility records; the patch does not touch those records.
  • Fresh AutoReview: scoped clean at P0/P1 after both follow-up corrections.

Live Matrix/Telegram validation was not redispatched; this PR relies on the original diagnostics artifact plus focused local owner-boundary proof.

@clawsweeper

clawsweeper Bot commented Oct 2, 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 docs Improvements or additions to documentation gateway Gateway runtime size: XL labels Oct 2, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 2, 2026 02:40
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 10:46 PM ET / October 2, 2026, 02:46 UTC (Revision 2).

ClawSweeper review

What this changes

The branch backports Gateway changes that preserve accepted runs across transport-policy reloads while retaining grant revocation, and corrects proxy credential handling under a fixed startup authentication mode.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored backport remains necessary for release/2026.9.8 despite the original fix being on main. No actionable introduced defect or unresolved authority-proof blocker was found.

Priority: P1
Reviewed head: 240d701eb42612d402405bc13b5ee024ed945196

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful release backport with concrete final-effect coverage, focused override regressions, and no actionable introduced findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. 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 (terminal): The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. No stored-data contract changes.
Evidence reviewed 9 items Pinned backport ownership: The introduced delta is release base 3a1e3fa to original head 240d701. Raw test-merge parents match that base followed by that head; current-main differences were used only as behavioral context.
Release base still couples transport and source authority: The original release-base implementation invalidates sources whenever the transport authentication policy changes. This establishes why a release backport remains useful.
Separate transport fencing and grant revocation: The patch captures identity scopes, authentication-method availability, proxy membership, fallback credential identity, and browser-origin admission separately from transport policy. Transport closure revokes retained work only when its grant changes.
Findings None None.
Security None None.

How this fits together

The Gateway authenticates client requests and applies configuration changes to running connections. Its retained-authority owners determine whether accepted session turns and delegated work may continue after those connections close.

flowchart LR
 A[Authenticated request] --> B[Captured access grant]
 C[Committed configuration change] --> D[Transport policy check]
 C --> E[Current grant check]
 D --> F[Reconnect client]
 B --> E
 E --> G[Continue or revoke accepted work]
 G --> H[Guard final side effects]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +274, Tests +931, Docs +9. Total +1214 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 18 361 87 +274
Tests 9 985 54 +931
Docs 2 23 14 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 29 1369 155 +1214

Review metrics

None.

Root-cause cluster

Relationship: same_root_cause
Canonical: #160909
Summary: This PR backports the merged main repair to a release branch and adds a startup-mode edge-case correction.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep transport reconnect decisions separate from retained grant revocation on the release branch, with live authority checked before initial-turn persistence and delegated effects.

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

Yes, for the targeted release base: its policy reconciliation revokes accepted sources on transport changes, matching the reported validation failures. Current main already separates those decisions; this read-only review did not execute either revision.

Is this the best way to solve the issue?

Yes. The backport reuses the existing admission, reload, and retained-authority owners, and the startup-mode correction preserves the effective authentication contract without adding configuration or storage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 949f3f52121b.

Labels

Label changes:

  • add P1: The release-validation failure cancels accepted channel work during configuration reloads.
  • add merge-risk: 🚨 message-delivery: The backport intentionally changes which accepted and queued turns survive reconnects; the carried boundary proof covers continued execution.
  • add merge-risk: 🚨 security-boundary: Accepted authority intentionally outlives its socket under the merged main design; inspected final-effect proof covers irreversible grant revocation.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. No stored-data contract changes.

Label justifications:

  • P1: The release-validation failure cancels accepted channel work during configuration reloads.
  • merge-risk: 🚨 message-delivery: The backport intentionally changes which accepted and queued turns survive reconnects; the carried boundary proof covers continued execution.
  • merge-risk: 🚨 security-boundary: Accepted authority intentionally outlives its socket under the merged main design; inspected final-effect proof covers irreversible grant revocation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported passing owner-boundary suites exercise the production managed reloader and dispatcher with retained operator authority and real native effects, including denial after revocation. The unchanged main proof also records real WebSocket initial-turn transcript persistence and rejection after token rotation. Live Matrix/Telegram validation was not repeated, and this reviewer ran no tests. No stored-data contract changes.

Evidence

What I checked:

  • Pinned backport ownership: The introduced delta is release base 3a1e3fa to original head 240d701. Raw test-merge parents match that base followed by that head; current-main differences were used only as behavioral context. (eb5ad2a42947)
  • Release base still couples transport and source authority: The original release-base implementation invalidates sources whenever the transport authentication policy changes. This establishes why a release backport remains useful. (src/gateway/server/ws-origin-policy.ts:58, 3a1e3fad9e9b)
  • Separate transport fencing and grant revocation: The patch captures identity scopes, authentication-method availability, proxy membership, fallback credential identity, and browser-origin admission separately from transport policy. Transport closure revokes retained work only when its grant changes. (src/gateway/auth-policy.ts:100, 240d701eb426)
  • Startup override correction: Proxy-transition classification and fallback-password grant reconstruction consume the resolver-attested startup mode. Added cases cover transport fencing and password rotation with file-selected and fixed startup proxy modes. (src/gateway/server-shared-auth-generation.ts:47, 240d701eb426)
  • Allowed and revoked final effects: The inspected managed-reloader harness drives the production dispatcher, retained operator authority, and native exec. It checks a written marker after transport reloads and an absent marker after scope, allowlist, or origin revocation, including restoration before the denied effect resumes. The primary body reports passing identity-scope reload tests. (src/gateway/server-reload-handlers.identity-scopes.test.ts:380, 240d701eb426)
  • Initial-turn persistence boundary: The real WebSocket sessions.create regression uses explicit non-main sessions and committed config-application receipts. The real transcript writer succeeds after transport fencing and refuses persistence after token rotation; inference is mocked. These proof files are unchanged relative to fetched main. (src/gateway/server.sessions.create.auth-policy.test.ts:167, 240d701eb426)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shakkernerd: 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 (1 earlier review cycle)
  • reviewed 2026-10-02T02:39:49.467Z sha 240d701 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 2, 2026
@RomneyDa
RomneyDa merged commit 41110b1 into release/2026.9.8 Oct 2, 2026
320 checks passed
@RomneyDa
RomneyDa deleted the fix/release-2026.9.8-channel-drain branch October 2, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime 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. P1 High-priority user-facing bug, regression, or broken workflow. 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.

1 participant