Skip to content

On-demand titles read only the newest messages and never mistake a retired default model for an empty chat - #13

Merged
TheFabFab merged 3 commits into
documentor-pgfrom
documentor-title-followup
Oct 22, 2026
Merged

TheFabFab merged 3 commits into
documentor-pgfrom
documentor-title-followup

Conversation

@TheFabFab

Copy link
Copy Markdown
Owner

Follow-up to PR #12 (the on-demand session title, released as v1.19.3-documentor-pg.3). It fixes the findings of the final whole-branch review.

Findings fixed

  1. The whole chat was loaded (important). title loaded every page of a chat, with its parts, to use the newest 20. It now collects with sessions.scanNewestFirst and stops once the window is full and the newest real user message is known. The stale-ifTitle check still answers before any message is read.
  2. A retired model read as an empty chat (important). When the caller names no model, the title used the newest user message's model. If that model had been removed from config, unknown_model → 400 came back, which DocuMentor reads as "nothing to title". Now unknown_model is returned only when the caller supplied the pair. On the defaulted path the title falls back to provider.defaultModel(), and a failure there is a defect (500).
  3. A small window could refuse a chat with plenty to title (minor). With messages: 1 on a chat ending with an assistant reply, the call answered 400. The newest user message (for user and the model default) is now found even when it lies beyond the window, and no_messages fires only for an empty window.
  4. One of providerID/modelID was silently ignored (minor). TitleInput and the route payload now check that both are given or neither, so one alone is a decode 400.
  5. A missing title agent gave a 200 (minor). On the on-demand path that is now a defect rather than 200 { applied: false }. The first-turn step still returns quietly.
  6. Matched queue entries could answer title requests (test infra). The fake model server now has a dedicated title queue (pushTitle, textTitle), and the main queue never serves a title request. The HttpApi exerciser still relies on the E2E Title auto-answer.
  7. FORK.md was out of date. The table rows are aligned, the llm-server row describes the title queue, and the SDK gen row lists session.title.

Tests: new documentor: cases cover the default-model fallback, the window of one, the missing title agent, and the route's both-or-neither rule. Before the fix each failed as expected (unknown_model, no_messages, a success exit, and 200 instead of 400); now each passes.

  • test/session/prompt.test.ts: 82 pass, 1 skip (the case that was already skipped), 0 fail.
  • test/server/httpapi-session.test.ts: 26 pass.
  • bun run test:httpapi: 209 pass, 0 fail in each of the three modes.
  • bun turbo typecheck: green.
  • The generated SDK and client are unchanged.

🤖 Generated with Claude Code

TheFabFab and others added 3 commits October 22, 2026 14:20
pushTitle and textTitle feed title requests only, ahead of the E2E Title
auto-answer; the main queue, matched or not, never serves a title request.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tired default model for an empty chat

- title scans newest first and stops once the window and the newest user
  message are found, instead of loading the whole chat
- the newest user message is found beyond the window, so messages: 1 on a
  chat ending with an answer titles it; no_messages only for an empty window
- a model the caller names must exist (unknown_model); a defaulted model that
  is gone falls back to the default model
- providerID and modelID come together or not at all (decode 400)
- no title agent is a defect on the on-demand path; the first turn still
  returns quietly

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…lback and the title queue

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Hey! Your PR title On-demand titles read only the newest messages and never mistake a retired default model for an empty chat doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@TheFabFab
TheFabFab merged commit 66db254 into documentor-pg Oct 22, 2026
6 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant