fix(session): a prompt that names no agent continues the conversation's agent - #141
Merged
Merged
Conversation
…'s agent The HTTP prompt handler fills a missing agent from the last user message, but callers of SessionPrompt.prompt directly — the design feedback route, orphan recovery, plugins — got the default agent instead, so a note from the browser flipped a design session to build. The route tests stub the prompt service, which is why nothing caught it. The fallback now lives in the service, where every caller passes: the last user message's agent, then the default only when there is no history. Same intent as upstream's open PR anomalyco#46106 (preserve agent and model on injected prompts), done at the one place it holds. Claude-Session: https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ
filipeforattini
enabled auto-merge (rebase)
September 5, 2026 19:39
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.
Found while reviewing upstream's open PRs: anomalyco#46106 there fixes injected prompts losing their agent. We had the same hole in a worse place.
The HTTP prompt handler fills a missing agent from the last user message (
handlers/session.ts:280), but callers ofSessionPrompt.promptdirectly — the design feedback route, orphan recovery, plugin-injected prompts — gotagents.defaultInfo(), i.e.build. A note from the browser flipped a design session to build. The route tests stub the prompt service, which is why nothing caught it.The fallback now lives in
createUserMessage, where every caller passes: the last user message's agent, then the default only when there is no history.Tested
New case in the prompt suite: a
planmessage followed by a prompt with no agent lands asplan; a fresh session with no history still getsbuild. Prompt, design route and orphan suites pass.https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.