← Back to Pull requests

feat(hub): per-turn title fallback for flavors without native rename tools #2317

Open
unknown opened this pull request with 366 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 07, 2026 18:30 UTC
Author

Stack order: #1976 → #2316 → this PR. This branch includes all commits of both (diff vs main contains #1976 + #2316 + the two new commits below). Merge in that order, or rebase this PR after the first two land.

Problem

The autoTitlePerTurn setting (#1976) makes session titles regenerate every turn — but only for flavors whose CLI prompt includes a rename tool (claude, codex, opencode, grok, pi). The steer is a system-prompt instruction; flavors without a native tool (dsh, kimi, cursor, copilot, agy) never receive it, so with the toggle on their titles stay frozen at the first-turn summary forever. The hub's automatic fallback is first-turn-only by design (titleSuggestionAutoAttemptedAt is claimed once), so it never revisits them either.

Fix

Add a hub-side per-turn branch to AutomaticTitleSuggestionService.onTurnCompleted, gated on all of:

1. the hub autoTitlePerTurn setting is enabled (same readAutoTitlePerTurnEnabled the CLI reads — one web switch governs both paths);
2. the session's metadata.flavor is in FLAVORS_WITHOUT_NATIVE_TITLE_TOOLS (flavors with a native tool keep using the CLI steer);
3. no manual pin holds the title.

When gated in, the hub asks the configured title provider after each completed turn and rewrites metadata.name via the new SessionCache.updatePerTurnSessionTitle. Manual pins always win:

  • the gate checks nameLocked / titleLocked on the raw store row (isSessionNamePinned) — the sanitized cache/wire view strips hub-owned fields, so a cache-view check would be blind to pins;

  • the write re-checks the pin under the metadata-version retry loop, so a rename issued while the provider call is in flight is honored;

  • a successful write emits a session-updated metadata patch (same pattern as updatePromptTitle) so connected web clients see the new title without a refetch.
  • The per-turn branch runs before the first-turn chain and returns early, so turn 1 of a gated session writes name directly instead of claiming the one-shot summary fallback. When the gate option is absent the code path is byte-identical to before (the absent-gate check is synchronous, preserving the existing microtask ordering the in-flight tests rely on).

    Depends on #2316 (paged conversation collection) so the per-turn regeneration also works on long sessions whose newest window is all tool output.

    Tests

  • dsh + toggle on: metadata.name rewritten after each of two turns; summary / titleSuggestionAutoAttemptedAt untouched.

  • claude + toggle on: untouched by the hub fallback (first-turn summary path as before).

  • dsh + toggle off: first-turn summary path as before.

  • dsh + toggle on + manually pinned name (via renameSession, the hub-owned pin path): provider never called.

  • dsh + toggle on + pin landing while the provider call is in flight: pinned name wins.
  • 🤖 Generated with Claude Code

    Diff: 366 lines (+274 / -92) across 4 files Reviewer: github-actions[bot] Review duration: 8m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 366 lines diff across 4 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 93% · Reviewer familiarity: 35%
    45%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.353
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #2317"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 45% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.7% (MEDIUM) · Higher = larger blast radius
    47.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 45% · Lower = rushed or shallow review
    45%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.2% · Safe to merge
    26.2%
    Repository