Skip to content

feat(ui): unify system notices in chat with a minimal line family - #122144

Merged
steipete merged 2 commits into
mainfrom
steipete/system-messages-unify-981dbb
Aug 11, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/system-messages-unify-981dbb

Conversation

@steipete

@steipete steipete commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

System-generated messages in the Control UI chat grew as four unrelated mechanisms and render as different visual species:

  • Model-facing recovery prompts (gateway-restart recovery, stranded-reply retry, subagent resume, restart sentinel) each hand-roll a [System] ... string; the UI regex-strips the prefix and dumps the raw model prompt as operator-facing copy under a bare "SYSTEM" label.
  • The compaction divider renders as a heavy pill with a bordered button — a different visual language for the same "system chrome" concept.
  • Copy had already drifted between producers ("gateway restart" vs "gateway reload").

There was also no reusable seam for adding the next lifecycle notice.

Why This Change Was Made

Maintainer-requested unification (design discussed and mocked up in-session). The design splits system messages into two explicit classes sharing one minimal visual family:

  • Class A — system turns (injected prompts the model acts on): rendered from typed internal_system provenance kinds as a hairline + icon + SYSTEM · <kind> label with one friendly operator summary line. The raw prompt is no longer shown for known kinds (no exact-prompt view by design).
  • Class B — lifecycle notices (operator-only facts, e.g. compaction): same line treatment, pill chrome removed, slim description + link-style action row.

Producer-side, one shared helper now owns the [System] prefix; the subagent resume copy is unified to "gateway restart". Channels never see any of this (unchanged). No protocol or __openclaw marker changes.

User Impact

  • Restart-recovery and other system turns collapse from a raw prompt paragraph to a single legible line + summary — significant transcript de-noising.
  • Compaction and future lifecycle notices share one consistent, minimal visual family in dark and light themes.
  • New system-notice kinds (both classes) are now a small registry entry + i18n keys instead of a new mechanism.

Before

before

After

after

Both screenshots are the same mocked-gateway fixture (restart-recovery turn + compaction marker) rendered through the Control UI e2e harness (Playwright/Chromium, dark theme) on pre-change vs post-change code.

Evidence

  • Focused suites (repo wrapper / direct vitest): ui/src/pages/chat/chat-thread.test.ts + chat-view.test.ts + components/chat-message.test.ts — 594 passed; system-notice-kinds.test.ts — 7 passed; src/sessions/input-provenance.test.ts — 23 passed; src/auto-reply/reply/stranded-reply-recovery.test.ts + subagent-registry-restart-recovery-helpers.test.ts — passed; main/subagent restart-recovery suites — 300 passed.
  • pnpm ui:i18n:baseline clean (source keys 4726); pnpm lint:ui:styles clean; git diff --check clean.
  • Visual proof: mocked Control UI e2e render (screenshots above), asserting both the restart-recovery notice and compaction divider render before capture.
  • Producer strings for main-session restart recovery and stranded-reply retry are byte-identical to before (exact-string test assertions); only the subagent resume copy changed ("gateway reload" → "gateway restart").
  • Deliberately NOT changed: stranded-retry runs get no internal_system provenance — the retry prompt is never persisted (transcriptPrompt/user-message persistence suppressed) and adding provenance would flip delivery-interactivity, reply-policy, and actor-classification branches.
  • formatSystemTurnPrompt lives in src/sessions/system-turn-prompt.ts (not input-provenance.ts) deliberately: input-provenance is type-reachable from 18 plugin SDK entrypoints, and this prompt convention is core-internal — plugins keep using prefixSystemMessage. The SDK API baseline is untouched.
  • Codex autoreview: clean on the full branch bundle (no actionable findings).

Class A (model-facing system turns: restart recovery, gateway restarted,
generic internal_system fallback) and class B (lifecycle facts: compaction)
now share one hairline+icon+label rendering; known kinds show operator
summaries instead of raw injected prompts. Core producers share one
formatSystemTurnPrompt owner for the [System] prefix; subagent resume copy
unified from "gateway reload" to "gateway restart". No protocol, channel,
or marker changes.
@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 11, 2026 16:46
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 12:53 PM ET / 16:53 UTC.

ClawSweeper review

What this changes

The PR gives Control UI system turns and compaction markers a shared minimal notice presentation, with concise labels for known restart events and one common system-prompt formatter for recovery producers.

Merge readiness

✅ Ready for maintainer review

No blocking correctness or security finding was identified. This maintainer-authored, maintainer-labeled PR should remain open for normal exact-head validation and maintainer handling.

Likely related people: Peter Steinberger — recent area contributor (medium confidence).

Priority: P3
Reviewed head: 37623f879ab09e7a4a86add51fa50bb05112b24f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent UI and producer cleanup with direct visual evidence and targeted regression coverage.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
Evidence reviewed 5 items Current chat boundary: Current main identifies persisted user messages with internal-system provenance at the chat-item boundary; the PR classifies known source tools there while retaining the generic fallback.
Canonical restart source: Main-session restart recovery uses the snake-case source-tool constant that the proposed registry recognizes.
Variable-text sibling: Restart-sentinel messages use a distinct source tool and carry variable text, supporting the PR's choice to preserve their body rather than replace it with a fixed summary.
Findings None None.
Security None None.

How this fits together

Recovery and lifecycle code persist internal messages and compaction markers in session history. Control UI converts those records into chat items, classifies recognized system sources, and renders an operator-facing transcript row.

flowchart LR
  A[Recovery producers] --> B[Session history]
  C[Compaction markers] --> B
  B --> D[Chat item builder]
  D --> E[System notice registry]
  E --> F[Notice and divider renderer]
  F --> G[Control UI transcript]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +133, Tests +86. Total +219 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 12 193 60 +133
Tests 7 105 19 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 298 79 +219

Review metrics

Metric Value Why it matters
Production versus test LOC production +193/-60 (net +133); tests +105/-19 (net +86) The production growth implements the shared notice metadata, renderer, and prompt-format owner; focused tests cover the new mapping and existing presentation behavior.

Stored data model

Persistent data-model change detected: serialized state: src/sessions/input-provenance.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep fixed operator summaries limited to recognized non-variable producer kinds, preserve generic variable system notices, and land only after exact-head checks complete.

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

Not applicable: this PR changes an existing Control UI presentation rather than reporting a failing behavior; its mocked browser fixture directly covers the affected rows.

Is this the best way to solve the issue?

Yes: classifying known provenance at the chat-item boundary and centralizing the shared prompt prefix avoids duplicating UI inference or producer formatting.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a contained Control UI presentation and maintainability improvement without evidence of urgent user impact.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
  • 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 supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.

Label justifications:

  • P3: This is a contained Control UI presentation and maintainability improvement without evidence of urgent user impact.
  • 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 supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The supplied before/after mocked Control UI browser fixture directly shows the changed restart-recovery and compaction presentation after rendering.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the source-tool constant, restart-recovery prompts, chat notice branch, divider renderer, and compaction row to this history boundary. (role: recent area contributor; confidence: medium; commits: 1ccd70180860; files: src/sessions/input-provenance.ts, src/agents/main-session-recovery/main-session-restart-dispatch.ts, ui/src/pages/chat/chat-thread-build.ts)

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.

Relocate formatSystemTurnPrompt to src/sessions/system-turn-prompt.ts so the
core-internal [System] convention does not widen the SDK API baseline; drop
the unused prefix/type exports; use var(--cursor-action) per cursor policy.
@steipete
steipete merged commit eef860d into main Aug 11, 2026
198 of 200 checks passed
@steipete
steipete deleted the steipete/system-messages-unify-981dbb branch August 11, 2026 17:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 2026
…enclaw#122144)

* feat(ui): unify system notices in chat with a minimal line family

Class A (model-facing system turns: restart recovery, gateway restarted,
generic internal_system fallback) and class B (lifecycle facts: compaction)
now share one hairline+icon+label rendering; known kinds show operator
summaries instead of raw injected prompts. Core producers share one
formatSystemTurnPrompt owner for the [System] prefix; subagent resume copy
unified from "gateway reload" to "gateway restart". No protocol, channel,
or marker changes.

* fix(ui): keep system-turn prompt helper out of the plugin SDK surface

Relocate formatSystemTurnPrompt to src/sessions/system-turn-prompt.ts so the
core-internal [System] convention does not widen the SDK API baseline; drop
the unused prefix/type exports; use var(--cursor-action) per cursor policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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: 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.

1 participant