Skip to content

feat(web-ui): Tidy chats with the auxiliary model - #961

Open
time-attack wants to merge 3 commits into
mainfrom
ai-chat-tidy-auto-archive
Open

feat(web-ui): Tidy chats with the auxiliary model#961
time-attack wants to merge 3 commits into
mainfrom
ai-chat-tidy-auto-archive

Conversation

@time-attack

@time-attack time-attack commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

What

A Tidy button (sparkle icon) next to Sessions in the sidebar. One click sends the viewer's active, unpinned, non-working chats to the auxiliary judge model in a single batched prompt and archives, in the viewer's own view, the ones the model marks finished. A toast reports the outcome. Archiving is per participant view and reversible from the Archived list.

No settings: live QA showed a settings popover was more friction than help, so the idle-days threshold and daily auto-tidy from the first revision were removed.

How

  • Core: POST /v1/sessions/tidy (source auth, user-scoped on principalId). app.tidySessions builds candidates from listSessions so working, awaiting-input, cron, watch, and background-job sessions are never touched. The 40 most idle go to orchestrator.judgeConcluded, which reads the last four turns of each sequentially, asks harness.models.judge (auxiliary model) for JSON, and only accepts ids from the candidate set. Transcript text cannot forge card boundaries.
  • Web UI server relays POST /api/sessions/tidy with the signed-in user as principal.
  • Mock harness dispatches on the tidy system prompt so the flow is testable (!done marks a finished chat).

Demo (dev instance, real Haiku judge)

Chats: a one-word France question, a NYC weather check, a flight search, a Stripe balance check, and an open Stripe migration plan. Tidy archived the France and weather chats and kept the rest. Toast: "Tidied 1 of 4 chats" on the second pass.

after

Screenshot lives on the qa-screenshots/ai-chat-tidy branch; nothing is mocked.

Tests

  • test/session-tidy.test.ts: pinned exclusion, judge result applied, stranger gets nothing.
  • plugins/web-ui/test/tidy-source.test.ts: panes closed before redraw, relay route order.
  • Typecheck + lint for both packages, plus process-run, portal-identity-gate, route-table, agent-api-parity.

Review

Independent review pass found and I fixed: missing user-scoped route registration, cron/watch/approval sessions eligible for archive, unbounded per-candidate reads, over-reported "considered" count, mock judge matching on user text, prompt-boundary forgery, prose-wrapped JSON, duplicated CSS.

Sina Matian added 3 commits September 6, 2026 00:23
Adds a Tidy control to the sessions sidebar. It sends the viewer's idle,
unpinned, non-working conversations (capped at the 40 most idle) to the
auxiliary judge model in one batched prompt and archives, in the viewer's
participant view, the ones the model marks finished. The popover holds the
idle-days threshold, an opt-in daily auto-tidy on app open, and a Tidy now
button; settings persist in localStorage like the Web-only toggle.

Core exposes POST /v1/sessions/tidy (user-scoped on principalId) and the
web-ui server relays it as POST /api/sessions/tidy. Model output is
constrained to candidate ids, transcript text cannot forge card
boundaries, and pinned, working, awaiting-input, cron, watch, and
background-job sessions are never candidates.
Anchored to its 22px button the 250px popover spilled past the sidebar's
left edge; anchoring to the header row keeps it inside the sidebar.
Live QA showed the settings popover was more friction than help: it
covered the list, and its idle-days gate meant the button appeared to do
nothing on fresh chats. Tidy is now one button that hands every active,
unpinned, non-working chat to the judge. The idle-days parameter and the
daily auto-tidy are gone from the API and UI, and candidate transcripts
are read sequentially so a tidy pass holds one database connection.
@time-attack time-attack changed the title feat(web-ui): Tidy idle chats with the auxiliary model feat(web-ui): Tidy chats with the auxiliary model Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant