Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

Commit

Merge pull request #210 from flagon-io/brief-room

Briefs leave the model room to think, so session titles and plan suggestions get answers (Part of #206)

syntaqxcommitted Parents0a3faeea0884feBrowse files
3 files+33−20/3 viewed
+3−1
301301
302302 /// The most of an [`AiBriefArgs`] input sent to the provider.
303303 pub const MAX_BRIEF_INPUT_CHARS: usize = 6_000;
304−/// The longest answer an [`AiBriefArgs`] may ask for.
304+/// The longest answer an [`AiBriefArgs`] may ask for. The provider is
305+/// given room beyond it to think first; the caller keeps only a short
306+/// answer.
305307 pub const MAX_BRIEF_TOKENS: u32 = 200;
306308
307309 /// `ask_settings`: what Ask answers with. Returns `Outcome<AskSetup>`.
+24−1
4040 }
4141 }
4242
43+/// Tokens a brief's model may spend thinking before it answers, beyond
44+/// the answer's own length. Current models think by default (Claude Haiku
45+/// 5.5 among them, at effort `medium`) and count it against `max_tokens`:
46+/// held to the answer's length alone, they used all of it thinking and
47+/// answered nothing, so session titles and the plan's suggestions came back
48+/// empty. Turning thinking off is refused by some (Claude Opus 5.5, Claude
49+/// Sonnet 5.5), so the room is given instead; callers keep only a short
50+/// answer whatever comes back.
51+const BRIEF_THINKING_ROOM: u32 = 2_048;
52+
53+/// The `max_tokens` a brief asking for an answer of `asked` tokens sends.
54+fn brief_room(asked: u32) -> u32 {
55+ asked.clamp(1, MAX_BRIEF_TOKENS) + BRIEF_THINKING_ROOM
56+}
57+
4358 const NO_SUCH: &str = "No such AI provider.";
4459 const NO_SEALER: &str = "AI providers are not set up on this g1t: it has no key to keep secrets with.";
4560
672687 rounds: &[],
673688 tools: &[],
674689 answer_now: false,
675− max_tokens: a.max_tokens.clamp(1, MAX_BRIEF_TOKENS),
690+ max_tokens: brief_room(a.max_tokens),
676691 }) {
677692 Ok(built) => built,
678693 Err(problem) => return Ok(fail(FailureCode::Invalid, problem)),
757772 use super::*;
758773
759774 #[test]
775+ fn a_brief_leaves_its_model_room_to_think_before_it_answers() {
776+ assert_eq!(brief_room(40), 40 + BRIEF_THINKING_ROOM);
777+ // Never more answer than a brief may ask for, never none.
778+ assert_eq!(brief_room(10_000), MAX_BRIEF_TOKENS + BRIEF_THINKING_ROOM);
779+ assert_eq!(brief_room(0), 1 + BRIEF_THINKING_ROOM);
780+ }
781+
782+ #[test]
760783 fn an_ai_provider_needs_its_key_and_its_address_when_it_has_no_known_one() {
761784 let key = Some("sk-test");
762785 let none = None;
+6−0
1+-- Triage suggestions asked for before integrations' ai_brief left its model
2+-- room to think (the model thought through its whole answer length and
3+-- answered nothing): asked again, once. Only open work items still in Triage
4+-- with no suggestion.
5+UPDATE work_items SET suggested_at = NULL
6+WHERE state = 'open' AND COALESCE(horizon, 'triage') = 'triage' AND suggestion IS NULL AND suggested_at IS NOT NULL;

Comments

Sign in to comment.