Skip to content

refactor(ui): share cached message extraction - #144244

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/ui-message-extraction-cache-rank110
Sep 11, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/ui-message-extraction-cache-rank110

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 10, 2026 •

Copy link
Copy Markdown
Member
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Maintainer-requested cleanup of duplicated caching in Control UI chat text and
reasoning extraction. This is a behavior-preserving refactor, not a bug fix.

Why This Change Was Made

Use one private, concrete cache-read helper while retaining the separate
module-lifetime text and thinking caches and their existing extractors. Original
object keys, lazy independent extraction, cached null and empty results,
non-object bypass, and uncached exceptions remain unchanged.

The change is limited to ui/src/lib/chat/message-extract.ts. No new exports,
test edits, caller changes, configuration, persistence, or appearance changes.

User Impact

No user-visible change. Chat text projection and reasoning formatting retain
their existing behavior.

Evidence

  • Existing message-extract.test.ts and chat-imported-history.test.ts: 59 tests
    passed on the baseline and the candidate. This is preservation PASS/PASS, not
    a defect reproduction.
  • Selected checks passed, including formatting, UI and selected core-test
    typechecks, dead-export checks, and targeted lint.
  • Independent review found no actionable findings through P2.
  • Configured Crabbox Linux proof used real Chromium with a mocked Gateway:
    chat-reasoning-visibility.e2e.test.ts and
    chat-export-attribution.e2e.test.ts passed 8/8 on the baseline and 8/8 on the
    candidate. Existing assertions cover reasoning visibility, reload, local
    toggles, formatting, copy, and export attribution.
  • Source-bound comparison: baseline
    680fc46558fd9ce72f903987a675633770202443, candidate
    70ad6dd13f5c16053b44776cc1eeebac5ff50b88. The materialized candidate tree
    matched the committed source tree; source and test blobs were verified before
    both runs.
  • Remote run: https://github.com/openclaw/openclaw/actions/runs/34516568702.
    Both test runs passed before the wrapper exited 1 during cleanup due to a
    transport timeout. Cleanup was subsequently recovered, and an independent
    provider status read confirmed completion. No global wrapper exit-0 claim.

Commands completed locally:

node scripts/run-vitest.mjs run --config ui/vitest.config.ts --configLoader runner \
  ui/src/lib/chat/message-extract.test.ts \
  ui/src/pages/chat/components/chat-imported-history.test.ts
node scripts/check-changed.mjs --base 680fc46558fd9ce72f903987a675633770202443 \
  -- ui/src/lib/chat/message-extract.ts

@vincentkoc vincentkoc self-assigned this Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 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 app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Sep 10, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 10, 2026 17:41
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 9:16 AM ET / 13:16 UTC (Revision 3).

ClawSweeper review

What this changes

Shares the Control UI’s cache-reading logic for chat text and reasoning while preserving their separate caches and existing output.

Merge readiness

✅ Ready for maintainer review

The unchanged head remains a sound, bounded cleanup with no actionable findings. Current main still contains the duplicated logic, and the prior review projection contains no outstanding findings or rank-up moves.

Priority: P3
Reviewed head: 70ad6dd13f5c16053b44776cc1eeebac5ff50b88

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving refactor with relevant existing coverage and no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored refactor. Its reported Chromium runs exercise the affected reasoning display and export consumers with a mocked Gateway; no authority-bearing behavior changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored refactor. Its reported Chromium runs exercise the affected reasoning display and export consumers with a mocked Gateway; no authority-bearing behavior changes.
Evidence reviewed 7 items Introduced change preserves cache semantics: The pinned merge-base-to-head diff only consolidates the two cache-read bodies. Both wrappers retain their original extractor and WeakMap; non-object bypass, null and empty results, object identity, and extraction-before-cache-write ordering remain unchanged.
Cleanup remains distinct on main: Current main retains the separate cache-read implementations. The affected file has no changes between the pinned merge base and fetched main, so unrelated endpoint drift does not establish a regression or supersession.
Latest release retains existing implementation: The v2026.9.4 source also contains separate text and thinking cache readers; this refactor is not already present in that release.
Findings None None.
Security None None.

How this fits together

The Control UI extracts display text and reasoning from chat message objects. These cached projections feed chat rendering, filtering, and Markdown export.

flowchart LR
  A[Chat message] --> B[Text or reasoning request]
  B --> C{Object already cached?}
  C -->|Yes| D[Separate text and reasoning caches]
  C -->|No| E[Existing extractor]
  E --> D
  D --> F[Chat display and export]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2. Total -2 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 15 17 -2
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 15 17 -2

Review metrics

None.

Technical review

Best possible solution:

Keep one private cache-read helper while retaining independent text and reasoning extraction and cache lifetimes.

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

Not applicable: the PR explicitly proposes a refactor, not a bug fix; its reported baseline/candidate checks demonstrate preservation rather than defect reproduction.

Is this the best way to solve the issue?

Yes. The private helper removes duplication without introducing another cache owner, public API, persistence format, or caller migration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5ff5dcefeb47.

Labels

Label justifications:

  • P3: This is a behavior-preserving internal cleanup with no new user-facing capability or configuration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored refactor. Its reported Chromium runs exercise the affected reasoning display and export consumers with a mocked Gateway; no authority-bearing behavior changes.

Evidence

What I checked:

  • Introduced change preserves cache semantics: The pinned merge-base-to-head diff only consolidates the two cache-read bodies. Both wrappers retain their original extractor and WeakMap; non-object bypass, null and empty results, object identity, and extraction-before-cache-write ordering remain unchanged. (ui/src/lib/chat/message-extract.ts:51, 70ad6dd13f5c)
  • Cleanup remains distinct on main: Current main retains the separate cache-read implementations. The affected file has no changes between the pinned merge base and fetched main, so unrelated endpoint drift does not establish a regression or supersession. (ui/src/lib/chat/message-extract.ts:51, 5ff5dcefeb47)
  • Latest release retains existing implementation: The v2026.9.4 source also contains separate text and thinking cache readers; this refactor is not already present in that release. (ui/src/lib/chat/message-extract.ts:51, 3a9d69db306c)
  • Existing coverage matches the affected consumers: Read the extraction and imported-history tests, plus both cited browser suites. They cover repeated extraction, absent messages, malformed blocks, imported display framing, reasoning visibility and formatting, reload, local toggles, and Markdown copy/download. The captured PR body reports 59 focused tests and 8 browser cases passing on both baseline and candidate; these were not rerun during this read-only review. (ui/src/e2e/chat-reasoning-visibility.e2e.test.ts:8, 70ad6dd13f5c)
  • Remote evidence is accurately qualified: The linked workflow is completed with a cancelled conclusion. The captured body explicitly distinguishes its reported passing browser runs from wrapper cleanup failure and subsequent recovery; it does not claim a globally successful workflow. Run: https://github.com/openclaw/openclaw/actions/runs/34516568702.
  • Historical routing: Current-main file history includes recent reasoning-formatting and broader chat-processing work by Peter Steinberger; GitHub commit metadata maps the recent reasoning change to steipete. Some older blobs needed for blame and pickaxe inspection were unavailable, so no source-line introduction attribution is claimed. (ui/src/lib/chat/message-extract.ts, c621c94d38eb)

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-09-10T17:53:23.084Z sha 70ad6dd :: blocked before merge. :: none
  • reviewed 2026-09-10T19:34:37.632Z sha 70ad6dd :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please refresh the completed review for unchanged head 70ad6dd13f5c16053b44776cc1eeebac5ff50b88; the native merge gate rejected the prior review after its 12-hour freshness window.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit fad8826 into main Sep 11, 2026
184 checks passed
@vincentkoc
vincentkoc deleted the refactor/ui-message-extraction-cache-rank110 branch September 11, 2026 13:21
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
* commit 'f2ce199238e974b1d4caff8f11112aa51eb00d9e': (310 commits)
  refactor(copilot): deduplicate transcript user text (#144888)
  refactor(sessions): await discovery and config readiness (#144854)
  refactor(e2e): deduplicate release file assertions (#144904)
  ci: keep growing hosted test plans within the job cap (#144965)
  fix(macos): avoid stale dashboard command assertions (#144710)
  refactor(memory): await standing intent operations (#144832)
  refactor(ui): derive native device settings types from schemas (#144705)
  refactor(memory): await journal operations and allocate sequences atomically (#144824)
  refactor(tests): share command field assertions (#144955)
  refactor(matrix): share bounded context cache insertion (#144939)
  refactor(i18n): share Apple catalog reader (#144848)
  fix(doctor): preserve legacy registry files when quarantine fails (#144787)
  refactor(tests): reuse PixVerse auth fixtures (#144926)
  fix(bonjour): silence transient ENODEV socket warnings (#144870)
  fix(matrix): preserve unrelated files when migration fails (#144883)
  feat(sqlite): run Team Reports storage in owned workers (#144871)
  fix(update): install explicit same-version artifacts (#144894)
  refactor(ui): share cached message extraction (#144244)
  refactor: normalize Claude usage responses at one boundary (#144707)
  refactor: simplify CLI child listener registration (#144929)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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