Skip to content

fix(ui): remove agent-archived sessions from the sidebar - #131461

Merged
steipete merged 2 commits into
mainfrom
openclaw/when-we-archive-a-session-via-agent-the-sidebar-doesn-t-update
Aug 28, 2026
Merged

steipete merged 2 commits into
mainfrom
openclaw/when-we-archive-a-session-via-agent-the-sidebar-doesn-t-update

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #131451

What Problem This Solves

Fixes an issue where users asking an agent to archive the currently open session would see the archived chat banner but the session would remain in the active Control UI sidebar. The same archive initiated through the sidebar menu already removed the row.

Why This Change Was Made

The session capability now derives sidebar visibility from its existing, identity-bound archive confirmation, whether confirmation arrives through a local patch or a Gateway event. Only the pending-click intent remains UI-local. This removes the duplicate confirmed-visibility store and its independent retirement logic.

The open transcript, route, title, archived banner, restore action, and existing cold archived-link behavior remain unchanged. No Gateway protocol, configuration, database, or provider contract changes.

User Impact

Agent-triggered archives remove the selected row without navigating away. Restore returns it to the active sidebar and re-enables the composer. A same-key replacement cannot inherit the old session's hidden state.

Evidence

  • Reproduced before the fix: both direct and subscription reconciliation regressions failed because archive visibility was undefined after confirmed archive.
  • Chromium pre-fix regression reproduced the reported mismatch: archived composer banner present, selected archived row still visible after waiting for removal.
  • Focused unit proof: 390 tests passed across session capability, roster refresh, identity replacement, and sidebar behavior.
  • Full archive browser suite: 11 tests passed, including external/agent patch events, menu pending state, archive filters, restore, selected transcript/title/route continuity, and navigation away/back.
  • Fresh autoreview on the original fix and final owner extraction: clean, no accepted/actionable findings.
  • pnpm build passed, including the production Control UI bundle and startup budgets.
  • Final node scripts/check-changed.mjs -- <10 changed paths> passed (format, guards, dead-code, i18n, core/UI typechecks, lint).
  • Real openai/gpt-5.6-luna Codex agent on an isolated loopback Gateway: actual sessions-tool archive, persisted archived: true, unchanged route, removed sidebar row, and in-place Unarchive restoring row/composer all verified. The live prompt allowed tool discovery; proof checks the actual tool/state, not the agent's promise.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/33138196854
  • Production LOC: +116/-120 (net -4). Tests/test support: +115/-3 (net +112).

Before: archive received, sidebar row still present

Before: archived chat but selected row remains

After: same chat retained, sidebar row removed

After: transcript and archive banner retained, sidebar row removed

Owner and provenance

The Gateway already emits authoritative archive state through sessions.patch -> sessions.changed. The gap was the UI's second archive-visibility store, populated only by the local menu action. The incomplete immediate-hide path was introduced in #129153 (code/PR author RoboClaw; merged by roboclaw-bot, August 25, 2026). The existing canonical confirmation owner came from #122641.

Direct dependency inspection: sibling Codex source codex-rs/app-server/src/dynamic_tools.rs:18 and codex-rs/app-server/src/request_processors/thread_processor.rs:598 / :1640. OpenClaw session archive is a Gateway-owned mutation, not Codex's separate thread/archive notification.

Related follow-up: #121436 / #123723 discuss strict sidebar filtering for cold archived deep links and banner-copy changes. Those broader policy changes are not part of this live-reconciliation repair.

AI-assisted: yes.

Real-agent proof

Live agent archive: tool call, final reply, archived composer and empty active sidebar

The inspected recording shows the actual tool call, sidebar removal without navigation, and UI restoration:

archive-sidebar-live.mp4

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 03:12
@steipete

Copy link
Copy Markdown
Contributor Author

Verified landing candidate: 085756d.

Root cause: local menu archive had its own confirmed visibility map; agent-triggered Gateway events updated the chat's canonical archive state but never that map. session-archive-state.ts now owns one identity-bound confirmation for both paths, with a separate pending-click set. Removed the old visibility helper and duplicate confirmation retirement. Production +116/-120 (net -4); tests/support +115/-3.

Proof actually run:

  • Pre-fix node scripts/run-vitest.mjs ui/src/lib/sessions/index.test.ts -t 'shares confirmed archive visibility': both direct/subscription regressions failed.
  • Pre-fix Chromium agent-archive regression: archived banner visible but selected sidebar row never detached.
  • node scripts/run-vitest.mjs ui/src/lib/sessions/index.test.ts ui/src/lib/sessions/list-options.test.ts ui/src/lib/sessions/index.event-refresh.test.ts ui/src/components/app-sidebar.test.ts: 390 passed after the final extraction.
  • OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.archive.e2e.test.ts: 11 passed after the final extraction.
  • pnpm build: passed, including bundled UI and startup budgets.
  • node scripts/check-changed.mjs -- ui/src/components/session-organizer-operations.runtime.ts ui/src/e2e/session-management.archive.e2e.test.ts ui/src/lib/sessions/index.test.ts ui/src/lib/sessions/index.ts ui/src/lib/sessions/list-options.test.ts ui/src/lib/sessions/session-archive-visibility.ts ui/src/lib/sessions/session-archive-state.ts ui/src/lib/sessions/session-capability.ts ui/src/lib/sessions/session-mutations.ts ui/src/test-helpers/app-sidebar.ts: final run passed.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output: clean on the original fix and final extraction.
  • Local artifact drivers node --import ./scripts/tsx.mjs .artifacts/archive-sidebar/live-proof.mjs after and .artifacts/archive-sidebar/nudge.mjs: real Codex openai/gpt-5.6-luna agent, actual archive tool call, persisted archive, unchanged URL/transcript, row removal, then UI Unarchive returning row/composer. Own temporary Gateway/state/port only; temporary credential stores removed. No operator Gateway changes.

Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/33138196854 (awaiting final checks before native prepare/merge).

Before/after screenshots are in the PR body. Inspected real-flow recording:

archive-sidebar-live.mp4

No remaining behavior-proof gaps. Latest ClawSweeper comment currently reports review started; no Rank-up moves published yet. Will recheck before merge. Broader cold archived-link filtering/copy remains the distinct follow-up in #121436 / #123723.

@steipete
steipete merged commit 9458d8b into main Aug 28, 2026
208 checks passed
@steipete
steipete deleted the openclaw/when-we-archive-a-session-via-agent-the-sidebar-doesn-t-update branch August 28, 2026 03:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: agent archive leaves the selected session in the active sidebar

1 participant