feat(web-ui): Tidy chats with the auxiliary model - #961
Open
time-attack wants to merge 3 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
POST /v1/sessions/tidy(source auth, user-scoped onprincipalId).app.tidySessionsbuilds candidates fromlistSessionsso working, awaiting-input, cron, watch, and background-job sessions are never touched. The 40 most idle go toorchestrator.judgeConcluded, which reads the last four turns of each sequentially, asksharness.models.judge(auxiliary model) for JSON, and only accepts ids from the candidate set. Transcript text cannot forge card boundaries.POST /api/sessions/tidywith the signed-in user as principal.!donemarks 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.
Screenshot lives on the
qa-screenshots/ai-chat-tidybranch; 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.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.