Skip to content

fix(session): a prompt that names no agent continues the conversation's agent - #141

Merged
filipeforattini merged 2 commits into
mainfrom
fix/prompt-keeps-agent
Sep 5, 2026
Merged

filipeforattini merged 2 commits into
mainfrom
fix/prompt-keeps-agent

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 5, 2026

Copy link
Copy Markdown

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 of SessionPrompt.prompt directly — the design feedback route, orphan recovery, plugin-injected prompts — got agents.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 plan message followed by a prompt with no agent lands as plan; a fresh session with no history still gets build. Prompt, design route and orphan suites pass.

https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…'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
filipeforattini enabled auto-merge (rebase) September 5, 2026 19:39
@filipeforattini
filipeforattini merged commit 5416f9d into main Sep 5, 2026
12 checks passed
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