Skip to content

fix: keep /pair qr images visible in Control UI - #172806

Merged
steipete merged 11 commits into
mainfrom
fix/pair-qr-image-in-control-ui
Oct 15, 2026
Merged

steipete merged 11 commits into
mainfrom
fix/pair-qr-image-in-control-ui

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #172713

What Problem This Solves

Fixes /pair qr showing pairing instructions without a QR image in Control UI after chat history refreshes.

User Impact

Users can scan the QR alongside the unchanged pairing details. The existing expiry notice still applies, and the setup secret stays out of both the transcript and the browser's disk cache. Reloading, reconnecting, or changing authentication requires generating a fresh code. Other channels are unchanged.

Why This Change Was Made

The command and Gateway already produce the QR attachment. Its live reply shares the persisted message's identity, but history deliberately contains only the text. Control UI was replacing the live attachment with that text-only row, or discarding a late QR reply after history arrived first.

The existing projection publication owner now retains only the QR block for the same admitted native assistant identity. Canonical history continues to own text, metadata, and removal; session, agent, and lifecycle changes do not inherit the image. Logical reconnects, canonical authenticated-owner changes, authentication changes, and pane disposal retire the QR from the existing projection and QR-bearing memory snapshots, preserving ordinary history and run state. Rendering and channel delivery are unchanged. One shared QR sanitizer serves disk serialization and snapshot restoration, including openclawDisplayContent. Older version-2 snapshots lose QR credentials before hydration and are scheduled for a sanitized rewrite through the existing writer; ordinary text, images, identity, metadata, and pagination survive.

Production delta is +168/-7 (net +161); tests +318/-2; docs +7/-0. The positive production delta implements the missing live-media retention, connection-owned retirement, and shared disk-cache sanitization/upgrade repair; there was no superseded owner path to delete without unrelated cleanup.

Evidence

  • Final-head CI passed: run 38689281232 on 02f05b5915ecb23cd547f898074a6d9562fa281f, including all three UI shards (cache-upgrade and rendered-retirement regressions), UI E2E, production/test typechecks, lint, docs, performance, selected Node shards, boundary/baseline checks, and openclaw/ci-gate. No failed-job rerun was needed. Final-head GitHub code review completed without new findings; the P2 cache-upgrade thread has a repair reply and is resolved.
  • Inspected synthetic mock-Gateway Control UI screenshots below: submit /pair qr, receive the live image, publish the same persisted assistant row, and refresh history. Before: 0 QR images. After: 1 QR image. Pairing text is unchanged. Local image decoding found exactly one QR matching the nonfunctional synthetic payload.
  • Added CI regressions: keeps the live pairing QR through history refreshes (history first=%s); does not transfer a pairing QR across a different %s identity; keeps pairing QR credentials in memory without writing them to the browser cache; retires pairing QR credentials on %s without losing canonical history; restores and rewrites pre-sanitizer snapshots without pairing credentials (%s). These cover both arrival orders, repeated snapshots, history deltas, authoritative removal, identity/scope isolation, reconnect/auth/profile/disposal retirement, rendered QR removal before and after subsequent history, direct/prewarmed restoration of old version-2 records, sanitized disk rewrite, and raw disk serialization without changing live in-memory media.
  • Changed-file oxlint, oxfmt, git diff --check, and deslop passed. Codex autoreview: scoped-clean, no actionable P0–P2 findings (code review only).
  • Addressed the automatic review’s P1 connection-lifetime finding; retained panes and shared memory caches now retire QR credentials at their existing lifecycle boundaries. Also addressed the follow-up same-client authenticated-owner finding by consuming the existing Gateway presentation owner, including profile and recovery namespace identity.
  • Addressed the P2 pre-sanitizer cache finding and the equivalent ClawSweeper security/data-compatibility findings: existing credentials cannot enter hydration, old records are rewritten without them, and ordinary stored data remains usable. The lifecycle regression now reaches the production renderer for same-client user replacement and reconnect, covering the review’s rendered-isolation concern. Additional live proofs and negative controls remain intentionally unrun under the maintainer policy below.
  • Earlier CI run 38682638060, UI shard 3 caught an incomplete fixture in the new reconnect regression (loadAssistantIdentity was missing). The fixture now supplies the same stub used by sibling reconnect tests; assertions remain unchanged.
  • PR CI is the test gate per maintainer policy. Local regression suites, typechecks, production negative controls, live Gateway proof, and Crabbox/Testbox leases were intentionally skipped. CI covers the regression files and applicable UI/type/lint lanes; local test wall times are therefore not claimed.
Before history reconciliation fix After history reconciliation fix
Pairing text with missing QR Pairing text with scannable synthetic QR
Capture and deferred-write details

Capture uses the repository mock-Gateway and screenshot helpers, with a standalone Playwright assertion adapter; no test runner or real Gateway is started:

TMPDIR=/private/tmp/oc-r8-pairqr node --import tsx \
  --import ./.artifacts/pair-qr-screenshot-assertions.mjs \
  .artifacts/pair-qr-screenshot.mts before # or after

Read repair carries the admitted Gateway/account/session cache key and a sanitized immutable historical snapshot. The read owner checks its current key revision and database generation after awaited storage access, before scheduling repair. Repair uses the existing writer: invalidation clears pending work, and flush checks current per-key revisions and database generation before writing. The snapshot retains its historical session/metadata facts; the write owner assigns the new saved-at time. Database/store names, configuration, and bounds remain process-stable constants. No new cleanup writer or authority owner is introduced.

Retain live pairing media on the same admitted assistant row when canonical history replaces its text. Keep setup secrets out of browser disk snapshots and preserve existing expiry rendering and channel delivery. Add refresh-order, identity-isolation, and cache regressions.
@steipete
steipete marked this pull request as ready for review October 15, 2026 04:27
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T05:57:58.908675Z 02f05b5 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M labels Oct 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c654861555

ℹ️ 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".

Comment thread ui/src/pages/chat/history-merge.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4f4471a9a

ℹ️ 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".

Comment thread ui/src/pages/chat/chat-pane-context.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9df603c261

ℹ️ 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".

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves live pairing QR images through history refreshes while retiring them on connection changes and excluding them from browser storage.

Example: Run /pair qr, then refresh the same conversation’s history.

  • Before: The pairing instructions remain, but the QR image disappears.
  • After: One QR image remains beside the instructions until expiry or connection retirement.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and correct by inspection, with the prior findings resolved; confidence remains bounded by synthetic browser and in-process evidence.
Proof confidence 🦐 gold shrimp (3/6) ✨ media proof bonus Sufficient (screenshot): Inspected synthetic browser captures show allowed QR retention after history reconciliation; successful exact-head production-owner regressions reach the renderer and reject the previous user's QR after same-client replacement, credential change, and reconnect, including subsequent history refresh. This satisfies the authorized authority-boundary harness path for this maintainer-authored PR; live Gateway behavior was not exercised.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: The pairing instructions ask users to scan a QR image that disappears when history replaces the live reply.
Reason: Restores documented behavior, preserves the established live-only secret boundary, and carries maintainer direction.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a current Control UI defect, and the earlier cache-restoration finding is fixed without introducing another actionable defect.

Priority: P2
Reviewed head: 02f05b5915ecb23cd547f898074a6d9562fa281f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A live Gateway run and base-failing replay were intentionally not supplied; browser captures and exact-head renderer/storage regressions establish the scoped behavior.
Agent review details

How this fits together

Control UI reconciles live Gateway replies with canonical history, publishes the resulting transcript to its renderer, and saves sanitized browser snapshots.

flowchart TD
  A[Live Gateway reply] --> C[Session projection]
  B[Canonical history] --> C
  C --> D[Chat renderer]
  E[Connection and account lifecycle] --> C
  C --> F[Snapshot sanitizer]
  F --> G[Browser storage]
Loading

Technical review

Best possible solution:

Retain pairing media within the existing scoped projection and sanitize both snapshot writes and restoration through the existing storage owner.

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

Current-main terminal suppression and text-only history replacement explain the lost image; supplied before/after browser captures demonstrate the same scenario, but no target code was executed during this review.

Is this the best way to solve the issue?

The repair uses existing projection, presentation-scope, and snapshot owners, preserves canonical text and removal authority, and resolves the prior findings without a competing state store.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 520302d8ee63.

Provenance checked

  • Live-only pairing media keeps the original intent (fix: /pair qr fails to show QR code in chat surfaces #97933: Render useful QR media in chat surfaces while keeping pairing secrets out of durable history.)
  • Canonical session projection keeps the original intent (0f3e17e: Keep reconciliation and publication under one owner while preventing retired content from returning.)
  • Authoritative terminal suppression changes intended behavior with a stated reason (ad3f74f: Unify web and terminal transcript identity and avoid duplicate terminal replies; the PR explains why live-only QR enrichment must survive that suppression.)
  • Browser snapshot serialization changes intended behavior with a stated reason (be0d13c: Simplify lifecycle and serialization machinery without changing ordinary stored data; sensitive QR removal is a justified exception using the existing writer.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current main still has the affected terminal path: Fetched main retains unconditional authoritative-terminal suppression and has no pairing-media exception; the introduced diff supplies that exception. (ui/src/pages/chat/chat-gateway.ts:476, 520302d8ee63)
  • Prior cache finding resolved: Restoration strips pairing blocks from content and openclawDisplayContent before hydration and schedules sanitized rewriting through the existing writer; direct and prewarmed raw-record regressions preserve ordinary history. (ui/src/pages/chat/session-snapshot-store.ts:438, 02f05b5915ec)
  • Rendered isolation now covered: The lifecycle regression renders the production message component, observes the allowed image, then verifies its removal after reconnect, credential replacement, same-client user replacement, and disposal; subsequent history cannot restore it. (ui/src/pages/chat/chat-pane-connection-lifecycle.test.ts:147, 02f05b5915ec)
  • Inspected visual evidence: Both prepared screenshots were inspected: the mock-Gateway browser scenario changes from pairing instructions without an image to the same instructions with one synthetic QR image. (02f05b5915ec)
  • Exact-head validation: GitHub Actions run 38689281232 completed successfully on the reviewed head; the supplied check inventory reports no failed checks. (02f05b5915ec)
  • Existing live-only product contract: fix: /pair qr fails to show QR code in chat surfaces #97933 established typed live-only pairing media and deliberately omitted its secret from durable history; this repair preserves that intent. (052dc59526a2)

PR surface

Source +161, Tests +316, Docs +7. Total +484 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 168 7 +161
Tests 5 318 2 +316
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 493 9 +484

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +168/-7; tests +318/-2 Growth covers identity-scoped retention, lifecycle retirement, disk sanitization, and restoration of existing cached records.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Repairs a bounded pairing-image workflow failure in Control UI without changing channel delivery or Gateway authorization.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-15T05:38:51.668Z sha 9df603c :: needs real behavior proof before merge. :: [P2] Invalidate QR-bearing snapshots written before the sanitizer

Reviewed October 15, 2026, 2:11 AM ET / 06:11 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 15, 2026
@steipete
steipete merged commit f0f2363 into main Oct 15, 2026
108 of 109 checks passed
@steipete
steipete deleted the fix/pair-qr-image-in-control-ui branch October 15, 2026 07:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
* fix: keep pairing QR images visible in Control UI

Retain live pairing media on the same admitted assistant row when canonical history replaces its text. Keep setup secrets out of browser disk snapshots and preserve existing expiry rendering and channel delivery. Add refresh-order, identity-isolation, and cache regressions.

* fix: retire pairing QR state with its connection

* fix: bind pairing QR retention to the authenticated owner

* test: complete pairing QR reconnect fixture

* fix: discard persisted pairing QR credentials on restore
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 gateway Gateway runtime 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

/pair qr shows "Scan this QR code" prompt but no QR code image renders in the web UI

1 participant