Stop native chat jumping when Codex starts a foreground command (#26503)

* Keep foreground Codex commands out of the background strip

* Run the command-strip host regression in Node

* Exercise retained commands after their source turns end
This commit is contained in:
Brennan Benson
2026-10-08 13:02:03 -07:00
committed by GitHub
parent 5de53910aa
commit a062abffd2
18 changed files with 549 additions and 80 deletions
@@ -44,7 +44,7 @@ export class CodexBackgroundTaskTracker {
) {
this.commands = new CodexBackgroundCommandTracker(primaryThreadId)
this.childWork = new CodexChildWorkEvidence(primaryThreadId, executions, (threadId) =>
this.commands.threadTasks(threadId)
this.commands.threadCommands(threadId)
)
}
@@ -64,15 +64,18 @@ export class CodexBackgroundTaskTracker {
): boolean {
const itemEvent = event.method === 'item/started' || event.method === 'item/completed'
const command = itemEvent ? this.commands.observe(event) : null
const frame = readCodexBackgroundTaskFrame(event, this.primaryThreadId)
const commands = [
...unapproved.flatMap((abandoned) => this.commands.endUnapproved(abandoned) ?? []),
...(frame?.kind === 'turn' && frame.state !== 'working'
? this.commands.endTurn(frame.threadId, frame.turnId)
: []),
...(event.method === 'thread/closed'
? this.commands.endThread(event.threadId)
: command
? [command]
: [])
]
const frame = readCodexBackgroundTaskFrame(event, this.primaryThreadId)
if (frame?.kind === 'subagents') {
for (const child of frame.children) {
this.executions.register(