Skip to content

fix: stale completion notices open sessions on a different Gateway - #157103

Merged
steipete merged 1 commit into
mainfrom
codex/fix-background-notice-owner-631
Sep 24, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-background-notice-owner-631

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a completed background task's Open session action selecting its old session on a different Gateway. After an ordinary warm reload, the notification can survive a Gateway switch; clicking it previously changed the new Gateway's selected agent and session.

User Impact

An old completion notice no longer changes the newly selected Gateway's conversation. Reconnecting to the same authenticated account still allows opening the completed task.

Why This Change Was Made

Completion notices now share the palette's existing Gateway/account ownership check. The submitting owner is captured before asynchronous work and checked before publishing the completion and when its action is clicked. The background observer's wait/retry behavior is unchanged.

Evidence

  • Registered submission regression failed on the original code; the same-account reconnect control passed. The original changed-file run took 6.23 seconds. Final background-completion and palette suites: 51 tests passed, 6.42 seconds wall time.
  • Canonical browser proof used synthetic mock Gateways and real Connection settings controls. Following a warm reload, the original action navigated Gateway B to Gateway A's Reviewer session; the repair preserved Gateway B's Main session and Connection settings. The same-account reconnect control still opened the completed task. A cold switch removed the toast and did not reproduce the bug.
  • Owning UI production and UI-page test type checks passed (39.07s / 38.08s), along with scoped lint, formatting, and the changed documentation page's MDX check. Lint caught and removed an unnecessary default type argument in the regression test.
  • Independent review found no actionable P0–P2 issues. This is browser/mock-Gateway boundary proof; no operator Gateway was switched.

Before: after clicking the old completion notice, the replacement Gateway incorrectly opens the previous Gateway's Reviewer session.

After: the same click preserves the replacement Gateway's Main session and Connection settings.

Before: stale completion opens the old Reviewer session on the replacement Gateway

After: the replacement Gateway keeps its Main session and Connection settings

@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@steipete
steipete marked this pull request as ready for review September 24, 2026 06:52
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 3:01 AM ET / 07:01 UTC.

ClawSweeper review

What this changes

The Control UI binds background-session completion notices to their submitting Gateway and account, checks that owner before opening a session, and updates tests and documentation.

Merge readiness

✅ Ready for maintainer review

Keep open: current main and the latest release still have the stale-action bug, and this focused PR is a viable fix with browser evidence.

Priority: P2
Reviewed head: 3e689c1a219f31de5894028ed5cbbf67fbde5d49

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused owner check has useful browser and regression evidence with no identified blocking defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. 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 (screenshot): The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.
Evidence reviewed 8 items Current main remains affected: The current-main completion toast calls session selection and navigation without checking whether its originating Gateway or account is still selected.
Submitted owner is captured before asynchronous work: Submission preparation captures the client and prepares completion observation before the session-create request can yield.
Final-action owner check: The branch checks the captured Gateway URL, credential revision, and authenticated recovery scope before publishing a completion and again immediately before session selection.
Findings None None.
Security None None.

How this fits together

The Control UI sends a new background session to a Gateway and turns its completion into a notice. The notice’s Open session action changes the selected agent and session, then navigates the browser.

flowchart LR
  A[New Session submission] --> B[Gateway background run]
  B --> C[Completion observer]
  C --> D{Original Gateway and account?}
  D -- Yes --> E[Completion notice]
  E --> F{Owner current at click?}
  F -- Yes --> G[Open original session]
  D -- No --> H[Suppress stale notice]
  F -- No --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +17, Tests +55, Docs +2. Total +74 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 32 15 +17
Tests 1 56 1 +55
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 91 17 +74

Review metrics

None.

Technical review

Best possible solution:

Preserve the selected Gateway’s conversation when an old notice is clicked, while allowing the originating account to open its completed task after a transport reconnect.

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

Yes. Current main has the unguarded action, and the captured before-state supports a warm-reload, Gateway-switch, then Open session reproduction; this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. The branch reuses the palette’s Gateway/account ownership rule and checks it at both publication and click, keeping the repair within the existing Control UI owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: A stale notice can select the wrong conversation for multi-Gateway users after a warm reload, but the affected path is narrow.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.

Label justifications:

  • P2: A stale notice can select the wrong conversation for multi-Gateway users after a warm reload, but the affected path is narrow.
  • 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 (screenshot): The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed Control UI completion action was exercised in a browser through Connection settings with synthetic Gateways: the reported after-fix click preserved Gateway B’s Main selection and settings view, consistent with the inspected before/after screenshots. The PR also reports a same-account reconnect control; no operator Gateway was switched. No stored-data contract changes.

Evidence

What I checked:

  • Current main remains affected: The current-main completion toast calls session selection and navigation without checking whether its originating Gateway or account is still selected. (ui/src/pages/new-session/background-session-notice.ts:122, 7204d7df7b58)
  • Submitted owner is captured before asynchronous work: Submission preparation captures the client and prepares completion observation before the session-create request can yield. (ui/src/pages/new-session/draft-submission-input.ts:77, 3e689c1a219f)
  • Final-action owner check: The branch checks the captured Gateway URL, credential revision, and authenticated recovery scope before publishing a completion and again immediately before session selection. (ui/src/pages/new-session/background-session-notice.ts:127, 3e689c1a219f)
  • Credential revision contract: The Gateway store increments its connection revision when the URL or credentials change, making that part of the captured owner check meaningful. (ui/src/app/gateway-store.ts:276, 3e689c1a219f)
  • Regression coverage: The added cases check actions after Gateway, credential, and account changes, plus unscoped and same-owner reconnects; publication cases check stale-owner suppression. (ui/src/pages/new-session/draft-submission-background.test.ts:55, 3e689c1a219f)
  • Inspected browser proof: The captured PR body describes a real Control UI browser run through Connection settings with synthetic Gateways. Both attached screenshots were inspected: the before image shows the old Reviewer session selected, while the after image shows Gateway settings with Main still selected. The body also reports that a same-account reconnect still opened the task. (3e689c1a219f)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vyctorbrzezowski: 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.

@steipete
steipete merged commit a7bf6dc into main Sep 24, 2026
172 of 174 checks passed
@steipete
steipete deleted the codex/fix-background-notice-owner-631 branch September 24, 2026 07:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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