fix(codex): fork archived sessions without reopening the source (#2231)

* fix(codex): fork archived sessions without reopening the source

* fix(codex): reconcile interrupted archived fork recovery

* fix(codex): release rejected forks and serialize source startup

* fix(codex): fence unconfirmed resume startup across retries

* test(codex): validate durable resume recovery and serialize archive

* fix(codex): block local resume of pending archived fork sources

* fix(hub): coalesce concurrent resume requests to preserve idempotent startup

* fix(hub): bypass startup coalescing for PTY sessions
This commit is contained in:
Ananovo
2026-11-01 09:55:01 +08:00
committed by GitHub
parent 639f71b6a6
commit 46bae9b0f1
30 changed files with 1377 additions and 34 deletions
+13 -2
View File
@@ -519,7 +519,7 @@ export class CodexAppServerClient extends JsonLineParser {
return response as ThreadGoalClearResponse;
}
async disconnect(): Promise<void> {
async disconnect(options?: { gracefulTimeoutMs?: number }): Promise<void> {
if (this.socket) {
const socket = this.socket;
this.socket = null;
@@ -538,7 +538,18 @@ export class CodexAppServerClient extends JsonLineParser {
try {
child?.stdin.end();
if (child) {
if (child && options?.gracefulTimeoutMs && child.exitCode === null && child.signalCode === null) {
// Read/fork helpers have no active turns after archiving their
// temporary child. EOF normally exits the native server; avoid
// an expensive Windows process-tree probe in the Runner loop.
await new Promise<void>(resolve => {
const finish = () => { clearTimeout(timer); child.off('exit', finish); child.off('error', finish); resolve(); };
const timer = setTimeout(finish, options.gracefulTimeoutMs);
child.once('exit', finish); child.once('error', finish);
if (child.exitCode !== null || child.signalCode !== null) finish();
});
}
if (child && child.exitCode === null && child.signalCode === null) {
await killProcessByChildProcess(child);
}
} catch (error) {