fix(coding-agent): sync agent state after newSession setup callback
Move setup callback handling from interactive/rpc modes into AgentSession.newSession(). After setup() runs, sync agent state via replaceMessages() so the LLM has context and the UI renders the messages properly. fixes #968
This commit is contained in:
@@ -261,10 +261,8 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
||||
commandContextActions: {
|
||||
waitForIdle: () => session.agent.waitForIdle(),
|
||||
newSession: async (options) => {
|
||||
const success = await session.newSession({ parentSession: options?.parentSession });
|
||||
if (success && options?.setup) {
|
||||
await options.setup(session.sessionManager);
|
||||
}
|
||||
// Delegate to AgentSession (handles setup + agent state sync)
|
||||
const success = await session.newSession(options);
|
||||
return { cancelled: !success };
|
||||
},
|
||||
fork: async (entryId) => {
|
||||
|
||||
Reference in New Issue
Block a user