Skip to content

fix(langgraph): route each team turn afresh, bind tools without a template, apply team params - #85

Merged
Parv17k merged 3 commits into
mainfrom
fix/supervisor-turn-state-and-tools-default
Nov 12, 2026
Merged

Parv17k merged 3 commits into
mainfrom
fix/supervisor-turn-state-and-tools-default

Conversation

@Parv17k

@Parv17k Parv17k commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

What changed, and why

Four defects, found while building a multi-version agentic RAG demo on AgentShip against a self-hosted, OpenAI-compatible server (Qwen3 via llama.cpp).

  1. A team answered every follow-up turn with its first answer. The supervisor checkpoints its per-turn fields (route, specialist_results, attempts, resolved, pending_write, approved) with the thread, and nothing cleared them. On turn two, dispatch saw a result for every routed member, ran none, and returned turn one's answer again. classify now resets them at the start of each turn.
  2. A spec with tools: and no template: ran without its tools, with no error. The default graph only calls the model, so the README's calc.yaml bound nothing and the model guessed at 17 * 23. A spec that declares tools or MCP servers without a template now builds single.
  3. A team's params didn't reach its classifier or inline members. derive_graph_config named spec.model as the classifier's model, so classify re-resolved it without the team's params, and inline members were built without them too. A team pointed at a local server (api_base) or given reasoning_effort: none routed and answered with provider defaults. Classify now uses the team's engine-wired model, and inline members inherit the team's params.
  4. reasoning_effort: none was rejected. It's the value that turns thinking off on GPT-5.1 and on OpenAI-compatible servers hosting Qwen3-style hybrid models.

Because of fix 2, the conformance harness's fake model now needs bind_tools. The stock FakeListChatModel raises there, so the tool_calling cell would fail because of the harness, not the engine. It now accepts the tools and ignores them, as the engine's own test fakes do. Before, that cell passed while nothing was bound to the model at all.

How it was verified

  • Regression tests for fixes 1–3 (test_each_turn_in_a_thread_is_routed_afresh, test_tools_without_a_template_still_run, test_team_params_reach_the_classifier_and_inline_members) fail on main and pass here.
  • Driven for real: agentship run with a three-member team (researcher with a search_docs tool plus Postgres checkpoints, analyst, inline writer) on a Qwen3 server, and a 14-question golden set across five agent versions, several of them multi-turn on one thread. Before fix 1, the second turn on a thread repeated the first turn's answer; now it gets its own answer. agentship run calc.yaml --input "What is 17 times 23?" now calls the tool and returns 391.
  • In a clean venv with CI's install line: pytest -q gives 955 passed, 25 skipped, 3 xfailed. ruff check . and ruff format --check . exit 0, and agentship verify reports all declared capabilities proven with 0 over-claims.

Checklist

  • make test passes locally (CI's install line, in a fresh venv).
  • ruff check and ruff format --check are clean.
  • agentship verify still exits 0, with no new over-claims.
  • If an engine capability was declared or changed, its conformance cell proves it. (No capability changed; the tool_calling cell now proves a real bind.)
  • Public surface changes are reflected in docs/capabilities/. (No new surface. reasoning_effort gains one accepted value; happy to add a line if the docs list the values.)
  • docs/CHANGELOG.md has an entry under ## [Unreleased].
  • A non-obvious design decision has an ADR in docs/decisions/. (Not needed, I think: "tools without a template means single" follows from what the spec already says.)
  • Version numbers untouched.

Anything deliberately left undone

  • templates/single.py still uses create_react_agent, which LangGraph 1.0 deprecates in favour of langchain.agents.create_agent. That's out of scope here.
  • When a specialist fails, the supervisor's retry re-runs the whole specialist. A researcher that hits a transient connection error repeats all its searches. This isn't changed here, but it's worth knowing.

@Parv17k Parv17k added type:bug Behaves differently from what it says it does area:core Kernel — spec, seams, conformance grid area:langgraph Reference engine labels Nov 11, 2026
…, allow reasoning_effort none

- graph_supervisor: classify now clears the per-turn fields (route, specialist_results, attempts,
  resolved, pending_write, approved). They are checkpointed with the thread, so a follow-up turn
  inherited the previous turn's specialist_results, dispatch ran no member, and the team returned
  the previous answer again.
- engine: a spec with tools (or MCP servers) and no template now builds the single template. The
  default graph only calls the model, so the README's calc.yaml bound nothing and the model
  answered without its tools, with no error.
- spec: reasoning_effort accepts "none", which turns thinking off on GPT-5.1 and on
  OpenAI-compatible servers hosting Qwen3-style hybrid models.

Regression tests for the first two fail on the previous code.
…embers

derive_graph_config named spec.model as the classifier's model, so classify re-resolved it
without the team's params; inline members were built without them too. A team pointed at a local
server (api_base) or told reasoning_effort: none classified and answered with provider defaults.
Classify now uses the team's engine-wired model, and inline members inherit the team's params.
The regression test fails on the previous code.
The tool_calling conformance cell builds a spec with tools and no template. Now that such a spec
builds the single template, its graph really binds the tools, and the harness's stock
FakeListChatModel raises NotImplementedError from bind_tools. The fake now accepts and ignores
them, as the engine's own test fakes do. The cell used to pass while nothing was bound to the
model at all, the same silent drop the engine fix addresses.
@Parv17k
Parv17k force-pushed the fix/supervisor-turn-state-and-tools-default branch from 7030daa to c049245 Compare November 11, 2026 06:59
@Parv17k
Parv17k merged commit 58d7e77 into main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Kernel — spec, seams, conformance grid area:langgraph Reference engine type:bug Behaves differently from what it says it does

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant