Skip to content

improve: reduce repeated chat message identity work - #147210

Merged
steipete merged 1 commit into
mainfrom
codex/v8-message-identity-work
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/v8-message-identity-work

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #147208

What Problem This Solves

Persisted chat messages repeatedly resolve identity information that ordinary transcript rows do not need.

User Impact

Terminal clients spend less time reconciling durable assistant messages and mixed history. Message contents, ordering, run ownership, and commentary behavior stay the same; no configuration or migration is required. The measured absolute savings are small, and this does not establish faster whole-UI rendering.

Why This Change Was Made

Return immediately when an assistant has no stream item ID, and remove a metadata-enumerating fallback already covered by the preceding run-identity branches for Gateway/transcript JSON. Both changes belong in the shared identity reader. There is no new cache or invalidation lifecycle.

Evidence

  • 525 focused tests passed across shared projection, UI history/stream reconciliation, and TUI event routing. Fresh P0–P2 review found no actionable issues.
  • The real TUI durable-message handler, shared reducer, and requested ChatLog rendering passed all nine synthetic workloads in eight fresh processes: before/after/after/before on Node 26.8.2 and 24.19.0, Windows. Every process preserved complete state/render/callback output and the canonical loaded-module graph. Setup, transport, backend refresh latency, and terminal painting are outside the timing boundary.
  • Three measured samples per process, after three warmups; the table reports the mean of the two process medians for eight-message batches. Each listed improvement held in both comparison directions on both runtimes.
Workload Node 26 before → after Node 24 before → after
Assistant publication, 200 history rows 0.32 → 0.18 ms (44% less) 0.34 → 0.14 ms (60% less)
Mixed history/publication, 200 rows 0.80 → 0.35 ms (56% less) 0.81 → 0.44 ms (46% less)
User publication, 1,000 rows 1.12 → 0.87 ms (22% less) 1.02 → 0.84 ms (18% less)

Ordinary 200-row user batches were mixed on Node 26 (0.62 → 0.68 ms; the two comparisons moved in opposite directions), and improved on Node 24 (0.65 → 0.52 ms). Empty, first-message, one-row, duplicate, and wrong-session controls remain in the evidence; sub-millisecond measurements do not establish broad application speedups. Process CPU counters were too coarse for these batches and are not used for claims.

Real-browser synthetic-Gateway flows matched all 61 state/render snapshots per variant in both orders. The first timing comparison was mixed; another task's tests invalidated the reverse timing run. Both versions emitted existing native ResizeObserver notifications, so this is parity evidence, not clean-browser-diagnostic or UI-speed evidence.

All 27 other selected changed-code checks passed. The dead-export scan failed on two untouched script exports (canonicalProviderName and listPackagedStaticExtensionAssetOutputs); running the same scan on untouched base 2700b9e34e6f79afba980dac67508af4c6eb707e reproduced both findings. No baseline, ignore, or skip exception was added.

The branch was refreshed onto the upstream CI integration repair in #147203 after the first run caught an unrelated Workboard test cleanup error. The final diff remains the same one-file identity optimization, with identical measured source bytes. Renewed independent P0–P2 review was clean; required CI passed for refreshed head ff4668f (run 34772765411).

@clawsweeper

clawsweeper Bot commented Sep 13, 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 size: XS maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 17:15
@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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 2:00 PM ET / 18:00 UTC (Revision 2).

ClawSweeper review

What this changes

The shared chat identity reader skips run-ID work for messages without stream items and removes redundant metadata enumeration.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded optimization absent from the fetched main and latest release. No actionable correctness or security findings remain; the refreshed source matches the earlier reviewed version.

Priority: P3
Reviewed head: ff4668f50aa2e413960c35025a4bb08fcf5e0d37

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving optimization with relevant reported validation and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its reported production TUI processing measurements and browser parity checks exercise the affected reconciliation path without establishing whole-application speedups.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its reported production TUI processing measurements and browser parity checks exercise the affected reconciliation path without establishing whole-application speedups.
Evidence reviewed 9 items Introduced change and correctness: The pinned merge-base-to-head diff changes only the shared identity reader. For serialized metadata, a mirrorOrigin key makes the removed metadata-only fallback ineligible; without that marker, the preceding branch already returns the same canonical run ID. Missing stream item IDs still return undefined.
Shared reconciliation boundary: entryMatches calls the stream identity reader for both compared messages; persisted-message and snapshot processing reuse this path. The changed module imports only OpenClaw normalization code. Its behavior does not depend on executing a Codex harness or protocol.
Existing behavioral coverage: Inspected coverage preserves producer-owned assistant run IDs, separates imported identities, and reconciles commentary only for matching run/item identities, including replay after reconnect. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

Gateway clients combine persisted transcript rows with live chat events. The shared identity reader supplies the message, run, and stream-item identities used to reconcile those inputs for terminal and browser displays.

flowchart LR
  A[Persisted transcript rows] --> C[Shared identity reader]
  B[Live chat events] --> C
  C --> D{Stream item present?}
  D -->|Yes| E[Resolve stream identity]
  D -->|No| F[Skip stream identity work]
  E --> G[Reconcile chat messages]
  F --> G
  G --> H[Terminal and browser displays]
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 5 7 -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 5 7 -2

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #147208
Summary: This PR implements the linked request to remove redundant shared identity work.

Members:

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

Technical review

Best possible solution:

Preserve one shared identity owner and existing reconciliation semantics while eliminating unnecessary per-message work without adding cache state.

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

Not applicable as a functional bug reproduction: source confirms redundant work, and the PR reports bounded before/after measurements; this review did not execute benchmarks.

Is this the best way to solve the issue?

Yes. Removing redundant work at the shared reader is a narrow solution that preserves existing callers, identity precedence, and storage contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 201f11afefdb.

Labels

Label justifications:

  • P3: This is a small processing optimization with preserved behavior and no established urgent user-facing failure.
  • 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 maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its reported production TUI processing measurements and browser parity checks exercise the affected reconciliation path without establishing whole-application speedups.

Evidence

What I checked:

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)

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-09-13T17:23:20.450Z sha e1ad1ab :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/v8-message-identity-work branch from e1ad1ab to ff4668f Compare September 13, 2026 17:49
@steipete
steipete merged commit f9453b2 into main Sep 13, 2026
138 checks passed
@steipete
steipete deleted the codex/v8-message-identity-work branch September 13, 2026 18:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '2d87daf04b78992382299d552f15ac84a86a23ed': (1815 commits)
  fix(ui): distinguish tool activity with semantic icons (#147207)
  fix(linux): recover completed Quick Chat replies without resending (#146048)
  feat(desktop): unify Tauri title bar and window controls (#147097)
  refactor(test): share plugin fixture server shims (#147225)
  perf(gateway): defer worker workspace execution imports (#143496)
  fix(gateway): post-ack webhook work fails with "Async work scope is closed" (#144801)
  refactor(scripts): centralize upgrade survivor version floors (#146975)
  fix(ci): check publication registries before FRV fanout (#147184)
  fix(qa): align system-agent delegation with channel contracts (#145905)
  improve: reduce repeated chat message identity work (#147210)
  fix(channels): remove stale pre-tool previews from Slack and Telegram (#147106)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Reduce redundant identity work when projecting persisted chat messages

1 participant