Skip to content

Doc mode fix - #67

Merged
MathisWellmann merged 4 commits into
mainfrom
doc_mode_fix
Aug 31, 2026
Merged

Doc mode fix#67
MathisWellmann merged 4 commits into
mainfrom
doc_mode_fix

Conversation

@MathisWellmann

Copy link
Copy Markdown
Owner
  • return an Error when opt_crate_name is not set but DocMode uses tools.

@MathisWellmann MathisWellmann self-assigned this Aug 31, 2026
@github-actions

Copy link
Copy Markdown

Summary

The PR adds an InvalidDocMode error that agent_builder now returns when a tool-using DocMode is paired with None crate name (previously a silent fall-through that registered no doc tools), and switches the fractal-studio example from false to ThinkingLevel::Medium. The new match arm is correct and ordered after the Some arm; the example call compiles against the impl Into<ThinkingLevel> signature and matches the documented From<bool> semantics.

Issues

None

@github-actions

Copy link
Copy Markdown

Summary

The PR threads ThinkingLevel through the fractal-studio example, adds Error::InvalidDocMode for tool-based DocModes without a host crate, and adjusts one test. The new error arm breaks the documented None behavior and existing call sites, including the example the diff itself touches.

Issues

  • examples/fractal-studio/src/main.rs:771, blocker: the call still passes None with DocMode::default() (IndexAndTools, where uses_tools() is true), which now hits the new (None, true) arm in agent_builder and makes the app panic at startup via .expect(...). Fix: pass DocMode::Inline when no host crate is provided.
  • symbiont/src/inference/agent_builder.rs:175, major: the same arm breaks every existing None, DocMode::default() call site — examples/quantize/src/main.rs:396, rastrigin:165, fizzbuzz:104, counter:42, sort:248, tictactoe:347, tool-calling:173, batched-evolution:306, symbiont/benches/batch_throughput.rs:616 — and contradicts the doc comments at lines 124 and 211, which say doc_mode "has no effect" when opt_crate_name is None. Either fall through to no-tools for None or update all those call sites and the docs; also no test covers the new Err(InvalidDocMode) path.

@github-actions

Copy link
Copy Markdown

Summary

The PR makes Inline the default DocMode, adds an InvalidDocMode error for opt_crate_name == None with a tools mode, and switches fractal-studio to ThinkingLevel::Medium. It changes documented behavior and defaults without updating the in-file docs.

Issues

  • symbiont/src/inference/agent_builder.rs:175 (major): The new (None, true) => Err(InvalidDocMode) arm turns agent_builder(None, IndexAndTools|Tools, ...) from a working no-op into a hard error, but the doc comment in the same file (line 113) still states "With Nonedoc_mode has no effect." Previously valid calls now break; align the error with the documented contract or fix the doc.
  • symbiont/src/system_prompt.rs:185 (major): #[default] moved from IndexAndTools to Inline, so every DocMode::default() host now embeds the full API synopsis in the preamble on every inference request instead of the compact on-demand index — a silent latency/token regression the doc itself warns grows with API size.

…er` returns an error if no crate name is given
@github-actions

Copy link
Copy Markdown

Summary

The PR makes tool-based DocModes a hard error without a host crate name (Error::InvalidDocMode), flips the DocMode default to Inline, and passes ThinkingLevel explicitly in the fractal-studio example. The direction is sound, but it leaves the old "doc_mode has no effect" contract in system_prompt and init_agent docs/tests and adds no test for the new error.

Issues

  • Majorsymbiont/src/system_prompt.rs (system_prompt doc and test system_prompt_without_crate_ignores_doc_mode): the doc still claims doc_mode "has no effect" with None and the test still asserts success for IndexAndTools/Tools with None, but the new agent_builder arm (agent_builder.rs:175) returns Error::InvalidDocMode for exactly those combinations, so system_prompt can no longer reproduce any agent's preamble for those inputs. Update the doc/test (or reject there too) to match the new contract.
  • Majorsymbiont/src/inference/agent_builder.rs (init_agent doc, ~line 209): still says "With None, no host API is documented and doc_mode has no effect", yet init_agent(None, DocMode::IndexAndTools, …) now returns Err(InvalidDocMode), and no # Errors section mentions the new variant. Update the docs.
  • Major — Missing test for the new behavior: the diff edits the tests module only to fix the existing call's arguments; add an assertion that agent_builder(None, DocMode::Tools, …) fails with Error::InvalidDocMode (the sibling test shows the client builds offline, so no network is needed).

@github-actions

Copy link
Copy Markdown

Summary

The PR makes tool-based DocMode variants require a crate name (new Error::InvalidDocMode, raised in system_prompt and agent_builder) and moves #[default] from IndexAndTools to Inline. The error path is correct and tested, but the default flip silently reconfigures in-repo callers.

Issues

  • symbiont/src/system_prompt.rs:186 (major): Moving #[default] to Inline silently changes behavior for examples/evolving-trader/src/main.rs:696 and examples/struct-support/src/main.rs:39, which pass Some(crate) with DocMode::default(). They now get the full API synopsis inlined in every prompt instead of the compact index, lose the api_index/api_doc tools, and lose the DOC_TOOLS_MAX_TURNS budget that agent_builder only sets in its (Some, true) arm (rig's default of 0 turns remains for any own tools). Set DocMode::IndexAndTools explicitly in those examples if the tool mode is intended, and add a test pinning DocMode::default() == Inline so the next default flip cannot silently reconfigure callers again.

@github-actions

Copy link
Copy Markdown

Summary

The PR flips DocMode::default() from IndexAndTools to Inline and makes system_prompt/agent_builder return a new Error::InvalidDocMode when a tools-based mode is combined with None crate; examples and benches are consistent with the new contract. No blocker or major issue found: all DocMode::default() call sites verified via grep use None (behavior unchanged), the two Some(crate) sites were updated to IndexAndTools, From<bool> for ThinkingLevel still exists for the unmodified examples, and the new error path is covered by tests in both system_prompt and agent_builder.

Issues

None

@github-actions

Copy link
Copy Markdown

Summary

The PR flips DocMode's default to Inline and makes tool-based doc modes require a host crate: system_prompt and agent_builder now return a new Error::InvalidDocMode for None + IndexAndTools/Tools, with docs and examples updated to match. I verified all in-repo callers of agent_builder/agent_from_env/system_prompt (examples, benches), the impl Into<ThinkingLevel> signature that keeps false call sites compiling, and the new error tests; the change is internally consistent.

Issues

None

@MathisWellmann
MathisWellmann merged commit 7e5713d into main Aug 31, 2026
6 checks passed
@MathisWellmann
MathisWellmann deleted the doc_mode_fix branch August 31, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant