You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: amicode_ask answer flips develop/research sessions to plan mode (agent omitted in promptAsync) #1206
Problem: The deprecated amicode_ask tool ends the assistant turn, and the user's button-click answer arrives as a new promptAsync call with no agent field. The server's createUserMessage falls back to agents.defaultInfo() — the global default_agent: "plan" — silently flipping an active develop/research session into plan mode mid-campaign. The model then receives the plan-mode gag and goes read-only.
Approach: Two-layer fix: (1) server hardening — createUserMessage falls back to the session's tracked current agent before the global default, so any caller that omits agent continues the session's mode instead of resetting it; (2) client fix — thread the current agent into the two promptAsync calls in message-timeline.tsx (onAsk and widget-prompt) that omit it.
Scope: overlay engine (session/prompt.ts) + app (message-timeline.tsx). No interview flow, no score, no extension host changes.
Assumptions:amicode_ask remains registered (deprecated but not removed); the native question tool is unaffected (it's an in-turn tool call, never flips the agent). Fresh sessions are unaffected — current.agent is already plan/undefined, so the fallback chain is identical to today.
Evidence
Confirmed from live session data (ses_f5d21a3ceffekcFtdQib23wFYf, post-fix #1153):
#
role
agent
event
84
assistant
develop
calls amicode_ask
85
assistant
develop
empty step-finish (turn ended)
86
user
plan
button answer — no agent in promptAsync
87
assistant
plan
"I'm now in plan mode" — refuses to act
Normal typed messages in the same session carry develop correctly. Only the amicode_ask answer flips.
The #1153 reminders fix (the plan-to-executing un-gag) is deployed and correct — it addresses a different sub-problem (the reminder text after a legitimate mode switch). This bug is upstream of that: the mode switch itself is illegitimate.
Acceptance Criteria
A promptAsync call with no agent on a session whose current agent is develop produces a user message stamped develop (not plan)
The two promptAsync calls in message-timeline.tsx (onAsk at ~2558, widget-prompt at ~2534) pass the session's current agent
Fresh sessions (no prior turns) still default to plan as before
Regression test covers the omit-agent-continues-session-mode case
Key Decisions
Server fallback, not caller enumeration:createUserMessage checks current.agent before defaultInfo() — structurally covers every present and future omit-agent caller, matching the #1153 "no mode-name enumeration" philosophy.
Client belt-and-suspenders: the message-timeline.tsx calls also pass the agent explicitly, so even if the server fallback were removed, these callers wouldn't regress.
Constraints & Invariants
The native question tool is an in-turn tool call and is unaffected by this change.
amicode_ask is deprecated; this fix is a bridge until it's fully retired.
Prior Art
#1153 — the reminders fix that broadened the plan-to-executing un-gag to all primary agents (correct, deployed, addresses a different sub-problem).
Important
Problem: The deprecated
amicode_asktool ends the assistant turn, and the user's button-click answer arrives as a newpromptAsynccall with noagentfield. The server'screateUserMessagefalls back toagents.defaultInfo()— the globaldefault_agent: "plan"— silently flipping an activedevelop/researchsession into plan mode mid-campaign. The model then receives the plan-mode gag and goes read-only.Approach: Two-layer fix: (1) server hardening —
createUserMessagefalls back to the session's tracked current agent before the global default, so any caller that omitsagentcontinues the session's mode instead of resetting it; (2) client fix — thread the current agent into the twopromptAsynccalls inmessage-timeline.tsx(onAskand widget-prompt) that omit it.Scope: overlay engine (
session/prompt.ts) + app (message-timeline.tsx). No interview flow, no score, no extension host changes.Assumptions:
amicode_askremains registered (deprecated but not removed); the nativequestiontool is unaffected (it's an in-turn tool call, never flips the agent). Fresh sessions are unaffected —current.agentis alreadyplan/undefined, so the fallback chain is identical to today.Evidence
Confirmed from live session data (
ses_f5d21a3ceffekcFtdQib23wFYf, post-fix#1153):amicode_askNormal typed messages in the same session carry
developcorrectly. Only theamicode_askanswer flips.The
#1153reminders fix (the plan-to-executing un-gag) is deployed and correct — it addresses a different sub-problem (the reminder text after a legitimate mode switch). This bug is upstream of that: the mode switch itself is illegitimate.Acceptance Criteria
promptAsynccall with noagenton a session whose current agent isdevelopproduces a user message stampeddevelop(notplan)promptAsynccalls inmessage-timeline.tsx(onAskat ~2558, widget-prompt at ~2534) pass the session's current agentplanas beforeKey Decisions
createUserMessagecheckscurrent.agentbeforedefaultInfo()— structurally covers every present and future omit-agent caller, matching the#1153"no mode-name enumeration" philosophy.message-timeline.tsxcalls also pass the agent explicitly, so even if the server fallback were removed, these callers wouldn't regress.Constraints & Invariants
questiontool is an in-turn tool call and is unaffected by this change.amicode_askis deprecated; this fix is a bridge until it's fully retired.Prior Art
#1153— the reminders fix that broadened the plan-to-executing un-gag to all primary agents (correct, deployed, addresses a different sub-problem).