Repository navigation
JVNAUTOSCI-2517 Restore stable live LLM exchange/call IDs - #289
Merged
Merged
Conversation
The live Thinking card groups a prepared/sent/received/completed/failed
LLM lifecycle (and each fallback attempt) by call_id / llm_exchange_id,
with von_routes preserving those IDs from progress updates and chatTab.js
grouping on them. The orchestrator producer side was missing, so live LLM
rows fell back to fragile composite keys (test_orchestrator_live_llm_call_ids
was red: the _build_live_llm_exchange_id / _build_live_llm_call_id helpers
were gone and _build_live_llm_progress_payload no longer accepted the IDs).
Restore the producer contract:
- _build_live_llm_exchange_id: deterministic per-exchange id (stage,
workflow stage, prepared timestamp, request shape) prefixed "llm-".
- _build_live_llm_call_id: per-attempt id "{exchange}:attempt:{n}".
- _build_live_llm_progress_payload: accept and emit llm_exchange_id/call_id.
- Thread a single exchange id through both _run_llm_with_fallbacks and
_run_llm_with_tools_fallbacks: the prepared emit carries it directly, and
attempt_meta (spread into every per-attempt lifecycle event) carries the
exchange id plus the attempt's call id.
Adds a production-wiring test proving the orchestrator emits one shared
exchange id with distinct per-attempt call ids through the real fallback
path, alongside the restored helper/payload unit contract.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores the producer half of the live-LLM exchange identity contract. 2515 (thinking-card recovery surfacing) added the consumer side —
von_routespreservescall_id/llm_exchange_idfrom progress updates andchatTab.jsgroups live LLM rows by them — but the orchestrator stopped emitting those IDs, so live rows fell back to fragile composite keys.tests/backend/test_orchestrator_live_llm_call_ids.pywas red (helpers removed;_build_live_llm_progress_payloadno longer accepted the IDs).What changed
_build_live_llm_exchange_id— deterministic per-exchange id (stage, workflow stage, prepared timestamp, request shape), prefixedllm-._build_live_llm_call_id— per-attempt id{exchange}:attempt:{n}._build_live_llm_progress_payload— accepts and emitsllm_exchange_id/call_id._run_llm_with_fallbacksand_run_llm_with_tools_fallbackscompute one exchange id per prepared request; the prepared emit carries it directly, andattempt_meta(spread into every per-attempt lifecycle event: sent/received/completed/cancelled/failed) carries the exchange id + the attempt's call id. So every live lifecycle event carries the identity at top level — exactly the surfacevon_routespreserves andchatTab.jsgroups on.This completes 2515's contract rather than reverting it; it's a faithful restoration of the design originally introduced in JVNAUTOSCI-2398/2447.
Tests
test_orchestrator_live_llm_call_ids.py— now green (helper + payload contract).test_run_llm_with_fallbacks_emits_stable_live_llm_exchange_identity— proves the orchestrator emits one shared exchange id with distinct per-attempt call ids through the real fallback path.test_tool_progress_liveness.py(route serialisation side) green;test_orchestrator_model_fallback_execution.pygreen.🤖 Generated with Claude Code