Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/codex/codex-structured-prompt-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ function providerTurnId(session: CodexSession, turnId: string): string | undefin
return session.translator ? session.translator.commandProviderTurnId(turnId) : turnId
}

/** How long a Stop waits for Codex to open the turn it answered a send into. Under the quit
* path's eviction budget, which a close or quit queued behind the Stop spends. */
/** How long a Stop waits for Codex to open the turn it answered a send into. A close or quit queued
* behind the Stop spends this out of the eviction budget, so a full wait plus a slow provider
* close can overrun it; the next launch's recovery then settles the lease. */
Comment on lines +24 to +26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Qualify the next-launch recovery outcome.

When restart recovery lacks sufficient owner-death evidence, it can retain the unresolved lease and report execution_owner_reconciling. The comment currently states that recovery settles the lease unconditionally.

Suggested fix
- * close can overrun it; the next launch's recovery then settles the lease. */
+ * close can overrun it; the next launch's recovery attempts to settle the lease, but may
+ * retain it as unresolved and report `execution_owner_reconciling`. */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/** How long a Stop waits for Codex to open the turn it answered a send into. A close or quit queued
* behind the Stop spends this out of the eviction budget, so a full wait plus a slow provider
* close can overrun it; the next launch's recovery then settles the lease. */
/** How long a Stop waits for Codex to open the turn it answered a send into. A close or quit queued
* behind the Stop spends this out of the eviction budget, so a full wait plus a slow provider
* close can overrun it; the next launch's recovery attempts to settle the lease, but may
* retain it as unresolved and report `execution_owner_reconciling`. */

export const CODEX_STOP_TURN_OPEN_WAIT_MS = 5_000

/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/codex/codex-structured-turn-open-wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export function createCodexTurnOpenWaits(): CodexTurnOpenWaits {
resolve()
}
const bound = setTimeout(endWait, withinMs)
// A Stop's wait must never be what keeps the process alive at quit.
bound.unref?.()
waits.set(endWait, turnId)
}),
observe: (threadId, method, params) => {
Expand Down
Loading