Files
brain-of-reese/.agent/user_stories/long-answers.md
T

1.5 KiB

Story: Long Answers (No Truncation)

Phase: 11_long_answers.md · E2E: tests/e2e/test_long_answers.py

Narrative

As a user, I want Brain to be able to answer at full length (up to 32 768 output tokens) so complex questions ("walk me through the whole setup", "list every service and its config") get a complete answer instead of one that stops mid-sentence.

  • Given any question that deserves a long answer
  • When Brain streams its reply
  • Then the reply runs to its natural end — the model is allowed up to 32 768 output tokens, not a hard 700-token cap.

Acceptance criteria

  1. LLMClient.chat_stream sends max_tokens from settings (BOR_MAX_OUTPUT_TOKENS, default 32 768) — the hard-coded 700 is gone.
  2. A genuinely long streamed answer (several thousand words) arrives complete in the browser — final line intact (E2E).
  3. Setting is overridable via env; unit-tested.
  4. Unit + integration green, app/ coverage >90%, story E2E green in isolation, one --no-gpg-sign commit.

Playwright Mapping Rule

Test Scenario → tests/e2e/test_long_answers.py (mock LLM, seeded KB):

  1. test_long_answer_streams_to_completion — question with the "write a long answer" trigger → mock emits a ~4 000-word deterministic answer and honors max_tokens (word-based) → the browser shows the final line of the answer; under the old 700 cap the tail is missing.
  2. test_normal_answer_unaffected — a normal question still streams a complete, short answer.