Skip to content

feat(ui): automatic session attention states in the sidebar - #111035

Merged
steipete merged 3 commits into
mainfrom
claude/sidebar-attention-auto
Jul 19, 2026
Merged

steipete merged 3 commits into
mainfrom
claude/sidebar-attention-auto

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

When an agent session is blocked or broken — waiting on a question, waiting on a permission approval, or dead because inference failed (auth expired, out of credits) — the sidebar row looks exactly like a healthy idle session. The user learns about blocked agents only by opening each session.

Why This Change Was Made

Maintainer-requested: sessions that need the user must say so automatically, with no agent effort, as exception-only chrome consistent with the quiet-sidebar series (#110448-#110800).

User Impact

Each session row derives a closed attention state none | question | approval | error:

  • Question pending (question tool waiting): amber hand icon + "Waiting for your answer". Derived from the existing question queue (question.list + events), so it survives reconnects and clears the moment the question is answered.
  • Approval pending (exec/plugin/system approvals incl. the 1Password broker): amber key icon + "Waiting for approval", from the existing normalized approval queue; clears on approve/deny.
  • Run failed — including provider/inference failures: danger alert icon + "Run failed: " (e.g. "Model out of credits: openai/gpt-5.6"). New gateway projection lastRunError (sanitized, 160-char cap) carries the short reason to rows; acknowledgment is durable via the existing lastReadAt read marker — opening the session marks it read, a refresh does not resurrect dismissed failures, and a new failure re-raises attention.
  • Attention bubbles to parents (transitively for materialized children; via childSessionKeys matching for unloaded direct children), bypasses the 4-child display cap, and collapsed sections show an amber dot next to the running dot. Question/approval outrank error; rows are never reordered.
  • Accepted gap (commented in code): a failed child that was never loaded surfaces only after expanding its parent — the gateway's subagent projection collapses terminal states to "historical", and extending it was out of scope.

Mock-harness fixtures now demonstrate all three states (question, approval, failed with out-of-credits reason):

attention states

Evidence

  • node scripts/run-vitest.mjs ui/src/components/app-sidebar.test.ts — 133 pass post-rebase (new attention case file: each state renders icon+subtitle, precedence, collapsed-section dot, child bubbling incl. unloaded children, cap bypass, durable dismissal incl. refresh survival and re-failure).
  • Gateway: session-lifecycle + session-utils suites 144 pass; plugin session-entry projection contract 13 pass; chat-pane 37 pass (read-marker extension).
  • Live-verified in the mock dev harness (screenshot above; fixtures added in this PR).
  • Codex autoreview (gpt-5.6-sol), three rounds: round 1 found ephemeral error acks (fixed via durable lastReadAt), round 2 found unloaded-child bubbling gap (fixed for queue-derived states, failure gap documented), round 3 clean.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: L maintainer Maintainer-authored PR labels Jul 18, 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: 2049a1b1b2

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

cloudWorkerActive: isStoppableCloudWorkerPlacement(row.placement),
hasAutomation: row.hasAutomation === true,
unread: row.unread === true,
attention: this.resolveSessionAttention(row),

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.

P1 Badge Surface attention on the hidden main-session row

This derives attention only for SidebarRecentSession rows, but selectedAgentSessionRows() subsequently removes the selected agent's main session because renderHomeRow() is its sole sidebar entry point (ui/src/components/app-sidebar-session-navigation.ts:560-576 and ui/src/components/app-sidebar.ts:194-234). Since the Home row still renders only running/unread state, a pending question, approval, or failed run in the rolling main session—the default and most common chat session—shows none of the new attention UI. Apply the same attention projection and rendering to the Home row.

Useful? React with 👍 / 👎.

@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: c06fc36563

ℹ️ 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 on lines +271 to +272
child.runningChildCount > 0 ||
child.attention.kind !== "none",

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.

P2 Badge Preserve attention rows across top-level pagination

When an attention-bearing top-level session falls after the default 10-row limit, zonedVisibleSections() still filters it through limitSidebarSessionRows(), which preserves only active or pinned rows; this new exception applies only to the four-child cap. In the default expanded section there is also no collapsed-section attention dot, so a pending question, approval, or failure remains invisible until the user manually loads more sessions. Preserve attention rows through the top-level pagination filter as well.

Useful? React with 👍 / 👎.

startedAt: undefined,
endedAt: undefined,
runtimeMs: undefined,
lastRunError: undefined,

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.

P2 Badge Clear run errors in every lifecycle restart path

This clears lastRunError for the standard visible-turn recovery path, but sibling lifecycle starts do not maintain the new invariant. For example, buildRestartSafeChatTranscriptState() sets a previously failed session to running without clearing the old reason (src/gateway/server-methods/chat-restart-recovery.ts:350-376), and if admission then fails before a lifecycle error, terminalizeRestartSafeChatAdmission() sets status back to failed without supplying a new reason (src/gateway/server-methods/chat-restart-recovery.ts:401-414). The sidebar consequently attributes the previous run's error to the new failure; propagate this clearing to every lifecycle reset/start path.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Jul 19, 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: 893a6e6d75

ℹ️ 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 on lines +79 to +80
setQuestionPromptClient(this.questionPromptState, client);
if (client) {

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.

P2 Badge Clear cached questions when list recovery is unavailable

When the UI reconnects to a gateway that does not advertise question.list—for example after switching endpoints or downgrading—the client becomes null, but setQuestionPromptClient() leaves the existing prompt map intact and the guarded refresh never runs. Any question cached from the previous connection therefore continues to mark its persisted session as waiting until its original expiry, even though the new gateway cannot resolve it; clear or invalidate cached prompts when connected recovery is unavailable while retaining them for ordinary temporary disconnects.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 18, 2026, 8:24 PM ET / July 19, 2026, 00:24 UTC.

Summary
Adds automatic question, approval, and failed-run attention states to Control UI sidebar sessions, including a persisted sanitized failure reason projected through the gateway.

PR surface: Source +846, Tests -21, Other +50. Total +875 across 30 files.

Reproducibility: not applicable. as a feature PR: the reported sidebar visibility gap is directly represented by the added UI fixtures and screenshot, rather than a current-main bug reproduction.

Review metrics: 1 noteworthy metric.

  • Persisted session projection: 1 added field: lastRunError. It changes a plugin-visible SessionEntry namespace and therefore needs upgrade compatibility treatment, not only UI coverage.

Stored data model
Persistent data-model change detected: persistent cache schema: ui/src/pages/chat/chat-pane.test-support.ts, serialized state: src/config/sessions/terminal-status.ts, serialized state: src/config/sessions/types.ts, serialized state: src/gateway/session-event-payload.ts, serialized state: src/gateway/session-lifecycle-state.test.ts, serialized state: src/gateway/session-lifecycle-state.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Preserve existing plugin SessionEntry extension-slot registrations or obtain explicit approval for a documented breaking contract.
  • Clear stale recovered question prompts when a newly connected gateway cannot advertise question.list.

Risk before merge

  • [P1] Merging the new reserved lastRunError SessionEntry slot can make an existing plugin fail its session-extension registration after upgrade.
  • [P1] A user who switches to an older or differently configured gateway can see a stale “Waiting for your answer” marker from the previous gateway.

Maintainer options:

  1. Preserve existing extension slots (recommended)
    Revise the persisted failure-reason projection so an already-installed plugin using lastRunError does not fail registration after upgrade, and add focused compatibility coverage.
  2. Approve an explicit breaking contract
    If maintainers intentionally reserve this name, document and approve the plugin upgrade break before merging.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve existing plugin SessionEntry extension-slot registrations while retaining a sanitized failure-reason projection; add focused compatibility coverage and rerun the affected gateway and UI tests.

Next step before merge

  • [P2] The stale-question repair is mechanical, but the persisted SessionEntry namespace collision requires an explicit maintainer compatibility decision before an automated repair should proceed.

Maintainer decision needed

  • Question: Should lastRunError become a new unnamespaced persisted SessionEntry field despite potential external session-extension slot collisions, or should the failure projection use a compatibility-preserving shape?
  • Rationale: The PR changes a plugin-visible persisted session-entry namespace; choosing whether to reserve a new core slot or preserve existing extension registrations is an API/upgrade contract decision, not a purely mechanical UI repair.
  • Likely owner: steipete — Recent merged sidebar work and the current proposal place this person closest to the intended UI and session-attention behavior.
  • Options:
    • Preserve extension compatibility (recommended): Use a compatibility-preserving projection or migration strategy so installed plugins with an existing lastRunError extension slot continue to load.
    • Accept the new reserved slot: Adopt lastRunError as a core-reserved SessionEntry property and explicitly document the breaking plugin-extension contract change.

Security
Cleared: The diff adds a bounded, sanitized user-facing failure projection and contains no concrete new credential, permission, dependency, or supply-chain concern in the supplied review surface.

Review findings

  • [P1] Preserve existing SessionEntry extension slots — src/plugins/session-entry-slot-keys.ts:54
  • [P2] Clear recovered questions when the new gateway cannot list them — ui/src/components/app-sidebar-session-attention.ts:72-80
Review details

Best possible solution:

Keep the automatic-attention design, but preserve existing plugin slot compatibility with an explicitly reviewed storage/projection shape and invalidate recovered question state when a newly connected gateway cannot authoritatively list it.

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

Not applicable as a feature PR: the reported sidebar visibility gap is directly represented by the added UI fixtures and screenshot, rather than a current-main bug reproduction.

Is this the best way to solve the issue?

No. The automatic-attention approach is appropriate, but the current persisted field reservation and cross-gateway cache handling are not the narrowest upgrade-safe implementation.

Full review comments:

  • [P1] Preserve existing SessionEntry extension slots — src/plugins/session-entry-slot-keys.ts:54
    Adding lastRunError to the reserved core-slot list makes any installed plugin that already registered this previously available SessionEntry slot fail registration on upgrade. Use a compatibility-preserving projection or an explicitly approved migration/contract path instead of silently claiming the name.
    Confidence: 0.87
  • [P2] Clear recovered questions when the new gateway cannot list them — ui/src/components/app-sidebar-session-attention.ts:72-80
    When a connected replacement gateway does not advertise question.list, the controller sets no usable client but retains the prior connection's prompt map. Those stale prompts continue to mark sessions as waiting until expiry; invalidate them on this endpoint/capability transition while retaining ordinary temporary-disconnect behavior.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: The feature improves a common sidebar workflow, while the identified faults have limited but real upgrade and stale-state impact.
  • add merge-risk: 🚨 compatibility: Reserving lastRunError in the persisted SessionEntry slot namespace can reject an existing plugin registration after upgrade.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): The PR supplies a direct mock-harness screenshot of the changed sidebar states alongside focused post-change test evidence; redact any private endpoint or account details in future proof updates.

Label justifications:

  • P2: The feature improves a common sidebar workflow, while the identified faults have limited but real upgrade and stale-state impact.
  • merge-risk: 🚨 compatibility: Reserving lastRunError in the persisted SessionEntry slot namespace can reject an existing plugin registration after upgrade.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): The PR supplies a direct mock-harness screenshot of the changed sidebar states alongside focused post-change test evidence; redact any private endpoint or account details in future proof updates.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies a direct mock-harness screenshot of the changed sidebar states alongside focused post-change test evidence; redact any private endpoint or account details in future proof updates.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR supplies a direct mock-harness screenshot of the changed sidebar states alongside focused post-change test evidence; redact any private endpoint or account details in future proof updates.
Evidence reviewed

PR surface:

Source +846, Tests -21, Other +50. Total +875 across 30 files.

View PR surface stats
Area Files Added Removed Net
Source 23 918 72 +846
Tests 6 107 128 -21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 51 1 +50
Total 30 1076 201 +875

What I checked:

  • Plugin session-slot compatibility: The branch adds lastRunError to the persisted SessionEntry shape and simultaneously reserves that previously available extension slot name. An installed plugin that already registered lastRunError will now be rejected rather than upgraded safely. (src/plugins/session-entry-slot-keys.ts:54, 2049a1b1b2d4)
  • Stale question state on endpoint switch: The current branch's new attention controller retains the question-prompt map when the next connected gateway does not advertise question.list; the recorded review identifies this as leaving a prior endpoint's pending-question marker visible until expiry. (ui/src/components/app-sidebar-session-attention.ts:72, 2049a1b1b2d4)
  • Focused coverage and visible UI proof: The PR body reports focused sidebar, gateway, projection, and chat-pane coverage plus a mock-harness screenshot that directly shows the new sidebar states; the supplied checks context also records the UI and real-behavior-proof jobs as successful. (ui/src/test-helpers/app-sidebar-cases/attention.ts:1, 893a6e6d75e4)
  • Related sidebar ownership history: The supplied related-item context shows merged sidebar work by steipete in the same quiet-sidebar series, making that history the closest available routing signal for this UI surface. (ui/src/components/app-sidebar-session-navigation.ts:1, ffb7c9831229)

Likely related people:

  • steipete: Merged quiet-sidebar work in the related series touches the same session-sidebar presentation area, and this PR continues that design line. (role: recent sidebar contributor; confidence: medium; commits: 679f9fcc6819, ffb7c9831229; files: ui/src/components/app-sidebar-session-navigation.ts, ui/src/components/app-sidebar-session-list.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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 6c2973d into main Jul 19, 2026
169 of 173 checks passed
@steipete
steipete deleted the claude/sidebar-attention-auto branch July 19, 2026 00:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
…#111035)

* feat(ui): automatic session attention states in the sidebar (question, approval, failed run)

* test(ui): split attention presentation and read-marker cases under line budgets

* fix(ui): restore precise chat-pane test-support signatures
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…#111035)

* feat(ui): automatic session attention states in the sidebar (question, approval, failed run)

* test(ui): split attention presentation and read-marker cases under line budgets

* fix(ui): restore precise chat-pane test-support signatures
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 gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant