fix(orchestrator): use active session's provider/model when injecting prompts#142
Open
ryuhaneul wants to merge 1 commit into
Open
fix(orchestrator): use active session's provider/model when injecting prompts#142ryuhaneul wants to merge 1 commit into
ryuhaneul wants to merge 1 commit into
Conversation
… prompts _inject_prompt builds AgentRequest without provider_override/model_override, so CLIService falls back to the bot's default. Sessions are per-topic, so a chat can have one topic on Codex and another on Claude even when the default is claude. When the default disagrees with the topic's active session, --resume goes to the wrong CLI and emits "No conversation found with session ID:" — surfaced to the user although the task completed. Same path covers async inter-agent result injection. Same family as PleasePrompto#82/PleasePrompto#81 (d38d738), which added a retry in handle_interagent_message but did not cover the _inject_prompt path. Reuse active session's provider/model; fall back to None when no active session exists. Add unit tests covering codex/claude/None active. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Background
_inject_promptinorchestrator/injection.pybuilds theAgentRequestwithout
provider_overrideormodel_override, soCLIServicefallsback to the bot's default provider/model.
Sessions are per-topic (
SessionKey(transport, chat_id, topic_id)), so asingle chat can have one topic on Codex and another on Claude even when
the bot default is
claude. When the default disagrees with the topic'sactive session provider,
--resume <sid>hits the wrong CLI:The empty result becomes the envelope's
result_textand surfaces inthe user chat as the visible reply, even though the task completed
normally (
status=doneorfailed). The same path covers asyncinter-agent result injection, so sub-agent results into a
different-provider topic hit it too.
Same family as #82/#81 (d38d738), which added a stale-session marker
and retry to
handle_interagent_message. The_inject_promptpath wasnot covered.
Proposed change
Reuse the already-resolved active session and pass its provider/model:
When
active is None, both stayNoneand behavior is unchanged.Consistency
Other resume sites already pass per-session provider/model — e.g.
flows.named_session_flowusesprovider_override=ns.provider, model_override=ns.model. The inject path was the odd one out.Test plan
tests/orchestrator/test_injection.pymockingget_activeand asserting the captured
AgentRequestuses the activesession's provider/model (and falls back to
Nonewhen no activesession).
ruff check,ruff format --check,mypyclean.status=donetask. Before:No conversation found …in userchat. After: result delivered cleanly.