Revert "Preserve OpenCode session across command completion, control SessionS…" (#14943)

This reverts commit 1da1bdc01c.
This commit is contained in:
Jinjing
2026-08-16 12:33:28 -07:00
committed by GitHub
parent bf6dc6fcba
commit ef1224c4f7
10 changed files with 20 additions and 411 deletions
@@ -216,15 +216,6 @@ describe('shared agent-hook-listener', () => {
},
'production'
)
const sessionStart = normalizeHookPayload(
state,
'mimo-code',
{
paneKey: PANE_KEY,
payload: { hook_event_name: 'SessionStart', sessionID: 'mimo-session' }
},
'production'
)
expect(message?.payload).toMatchObject({
agentType: 'mimo-code',
@@ -235,7 +226,6 @@ describe('shared agent-hook-listener', () => {
expect(message?.providerSession).toMatchObject({ key: 'session_id', id: 'mimo-session' })
expect(tool?.payload).toMatchObject({ agentType: 'mimo-code', state: 'working' })
expect(idle?.payload).toMatchObject({ agentType: 'mimo-code', state: 'done' })
expect(sessionStart).toBeNull()
})
it('maps Kimi AskUserQuestion PreToolUse to waiting, then back to working on answer', () => {
+6 -13
View File
@@ -2437,7 +2437,6 @@ function isNewTurnEvent(source: AgentHookSource, eventName: unknown): boolean {
case 'amp':
return eventName === 'agent.start'
case 'opencode':
return eventName === 'SessionStart'
case 'mimo-code':
return false
case 'cursor':
@@ -3774,19 +3773,14 @@ function normalizeOpenCodeFamilyEvent(
paneKey: string,
hookPayload: Record<string, unknown>
): ParsedAgentStatusPayload | null {
const resetsTurn =
isNewTurnEvent(source, eventName) ||
(eventName === 'MessagePart' && hookPayload.role === 'user')
const stateName =
eventName === 'SessionBusy' || eventName === 'MessagePart'
? 'working'
: eventName === 'SessionIdle'
? 'done'
: source === 'opencode' && eventName === 'SessionStart'
? 'done'
: eventName === 'PermissionRequest' || eventName === 'AskUserQuestion'
? 'waiting'
: null
: eventName === 'PermissionRequest' || eventName === 'AskUserQuestion'
? 'waiting'
: null
if (!stateName) {
return null
@@ -3796,20 +3790,19 @@ function normalizeOpenCodeFamilyEvent(
state,
paneKey,
extractToolFields(source, eventName, hookPayload),
{ resetOnNewTurn: resetsTurn }
{ resetOnNewTurn: isNewTurnEvent(source, eventName) }
)
return normalizeAgentStatusPayload({
state: stateName,
prompt: resolvePrompt(state, paneKey, promptText, {
resetOnNewTurn: resetsTurn
resetOnNewTurn: isNewTurnEvent(source, eventName)
}),
agentType: source,
toolName: snapshot.toolName,
toolInput: snapshot.toolInput,
interactivePrompt: snapshot.interactivePrompt,
lastAssistantMessage: snapshot.lastAssistantMessage,
sessionBoundary: source === 'opencode' && eventName === 'SessionStart' ? true : undefined
lastAssistantMessage: snapshot.lastAssistantMessage
})
}