Repository navigation
feat(gateway): utility-model auto-titles for sessions beyond dashboard - #107739
clawsweeper[bot] wants to merge 1 commit into
Conversation
Generalize the dashboard-only LLM session titling so any agent session whose derived title would fall back to a truncated first message or a session-id prefix gets a one-time utility-model title after its first user turn. - Rename dashboard-session-title.ts to session-auto-title.ts and drop the dashboard-key restriction; add eligibility checks (agent session keys only, no ACP/cron-run keys, no slash commands, no explicit label/displayName/subject/origin label, first turn only, same session generation). - Gate generation on resolveUtilityModelRefForAgent so an explicit utilityModel "" (or a provider without a small-model default) disables auto-titles instead of falling back to the primary model. - Add a sticky per-session-generation attempt marker so the gateway chat.send trigger and the reply pipeline trigger spend at most one utility request per session, including after failed attempts. - Trigger fire-and-forget generation from the reply pipeline for inbound channel sessions, skipping system events (heartbeat, cron-event, exec-event). Implements the maintainers-Discord proposal to name sessions with a small model; no new config knobs, reuses existing utilityModel routing. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Codex review: found issues before merge. Reviewed August 2, 2026, 6:40 AM ET / 10:40 UTC. ClawSweeper reviewWhat this changesThe PR expands one-time utility-model session titles from dashboard chats to eligible non-dashboard and inbound-channel sessions. Merge readiness⛔ Blocked by patch quality or review findings - 12 items remain This draft is still useful only if maintainers want automatic titles for inbound-channel and non-dashboard agent sessions, but it is not safe to merge as written. Its unchanged branch bypasses the current title-path ownership boundary, can fall back to the primary model, can overwrite channel or space names, and does not publish reply-pipeline writes to session observers. Priority: P3 Review scores
Verification
How this fits togetherGateway chat and inbound reply handling prepare session records before running an agent turn. The title helper derives a bounded display name from the first user message, resolves model and auth ownership, persists it to the session record, and notifies session-list clients. flowchart LR
A[Gateway chat or inbound reply] --> B[Session preparation]
B --> C[Title eligibility]
C --> D[Utility model and auth resolution]
D --> E[Guarded session record update]
E --> F[Session change event]
F --> G[Session lists and clients]
Decision needed
Why: Extending this behavior changes default model use and user-visible naming beyond the existing dashboard scope, while current main centralizes the required session-specific model, auth, and protected-name contracts. Before merge
Findings
Agent review detailsSecurityNeeds attention: No supply-chain change is present, but the title path can route first-message content through the primary model after utility-model failure, contrary to the stated egress and credential boundary. PR surfaceSource +63, Tests +40. Total +103 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the current dashboard title helper as the canonical owner, then—if maintainers sponsor cross-channel titles—rebase a narrow extension that passes the resolved utility model and auth owner into a fail-closed generation API, preserves every explicit-name field, and publishes a session update after persistence. Do we have a high-confidence way to reproduce the issue? Yes for the patch defects: utility-model failure reaches the primary fallback in Is this the best way to solve the issue? No. The branch predates the current title-path owner and duplicates its routing and persistence policy instead of extending it; a rebased, fail-closed API is the safer route if maintainers sponsor the feature. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against de0fa7c2084c. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
Sessions whose derived title would otherwise fall back to a truncated first message or a session-id prefix now get a one-time LLM-generated title — not just
dashboard:sessions. Titles are generated fire-and-forget on the utility model after the session's first user turn and persisted todisplayName, wheresessions_listand the UI already pick them up.chat.sendtrigger and a new trigger in the reply pipeline covering inbound channel sessions (Discord DMs, groups without a subject, unlabeled subagents, …).utilityModel: ""(per agent or inagents.defaults). No new config knobs — this reuses the existing utility-model routing; unset means the provider's declared small-model default. If routing resolves to nothing, generation is skipped entirely — it never falls back to the primary model, and the deterministic derived title remains.label,displayName,subject, ororigin.label— checked both before generation and again inside the guarded session-store write. ACP sessions, cron runs, slash commands, and system events (heartbeat/cron/exec) are excluded.Implements the maintainers-Discord discussion started by Omar Shahine about naming sessions with a small (haiku-class) model.
File-by-file details
src/gateway/session-auto-title.ts(renamed fromdashboard-session-title.ts)dashboard:-key restriction;isSessionAutoTitleCandidatenow accepts any agent session key, excluding ACP keys, cron-run keys, empty messages, and slash commands.resolveUtilityModelRefForAgent:utilityModel: ""(or a provider with no declared small-model default) disables generation instead of letting the shared simple-completion path silently fall back to the primary model.storePath + sessionKey + sessionId): both triggers can fire for one session, but at most one utility request is ever spent — including after a failed model call. Bounded set (4096) for long-lived gateways; eviction is safe because past-first-turn sessions fail thesystemSentcheck anyway.updateSessionEntrywith a recheck callback that aborts if the session generation was reset or a name appeared while the model call was in flight.src/gateway/server-methods/chat.tsmaybeGenerateDashboardSessionTitle→maybeGenerateSessionAutoTitle, plusisSessionAutoTitleCandidate); trigger logic and theemitSessionsChangedbroadcast ("chat.title") unchanged.src/auto-reply/reply/get-reply.ts!systemSent), skips system-event providers (heartbeat,cron-event,exec-event), uses the finalized message body as the title source. UI refresh for this path rides the existing run-lifecyclesessions.changedevents.src/gateway/session-auto-title.test.ts(renamed)global)/ACP/cron-run keys, channel subjects, and disabled utility routing skip; failed attempts are not retried within a session generation.Verification
pnpm tsgo:prod✅ andpnpm tsgo:test:root✅ (typecheck)oxlint+oxfmt --checkon all changed files ✅;pnpm check:import-cycles✅ (0 cycles)chat*/get-reply*suites 735 tests across 50 files ✅🤖 Generated with Claude Code