jg-agent-hq 13.5.0 → 13.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -0
- package/api/README.md +3 -3
- package/dist/actions/admission/admission.js +3 -3
- package/dist/store/control/admission/admission.model.js +12 -4
- package/dist/store/control/lifecycle/lifecycle.model.d.ts +3 -3
- package/dist/store/control/lifecycle/lifecycle.model.js +23 -14
- package/dist/store/control/observations/observations.model.js +1 -1
- package/docs/recovery.md +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 13.5.2
|
|
4
|
+
|
|
5
|
+
- Automatically rejoin previously managed Codex sessions after a shared connection loss or HQ restart when their verified latest native turn changed. Joining sends no input or settings, leaves earlier receipts unresolved and queues paused, and still refuses unverified state, pending submissions and turn changes during the join. Existing uncertain/external sessions still require explicit recovery.
|
|
6
|
+
|
|
7
|
+
## 13.5.1
|
|
8
|
+
|
|
9
|
+
- Allow confirmed recovery of a known quarantined Codex identity in the current HQ runtime, including loaded active, idle and unloaded sessions, without restarting HQ. Verify the native turn before and after joining, retain paused queues and unresolved receipts, and send no settings or input. Healthy controls, pending dispatches and unverified identities remain refused.
|
|
10
|
+
|
|
3
11
|
## 13.5.0
|
|
4
12
|
|
|
5
13
|
- Quarantine attributable Claude interpretation, registry and persisted-evidence failures without terminating native work or other controlled sessions. Suspend rich interpretation and controls; require fresh native idle, a known empty full task snapshot and no unresolved requests before automatic cleanup. Partial task activity invalidates older emptiness, and ordinary idle parking cannot bypass quarantine.
|
package/README.md
CHANGED
|
@@ -77,6 +77,8 @@ Native execution settings, instructions, skills and tool permissions remain with
|
|
|
77
77
|
|
|
78
78
|
When Claude sends structurally valid evidence HQ cannot interpret, HQ suspends that session's controls and live interpretation while its native work continues. It closes the quarantined controller automatically only after fresh native idle, a known empty task snapshot and no unresolved requests establish that work has finished. Unknown evidence or an unanswered approval keeps it alive; confirmed `thread-close` with `interrupt: true` explicitly stops its owned process group, including unfinished background work. Identity and transport-integrity failures retain their shutdown handling.
|
|
79
79
|
|
|
80
|
+
A quarantined known Codex identity offers confirmed recovery in the current runtime without an HQ restart. Recovery verifies the native turn before and after joining, sends no input or settings, keeps earlier queues paused and leaves uncertain receipts unresolved. Previously managed sessions also rejoin automatically after connection loss or runtime restart when their verified latest turn changed, without resolving earlier receipts or releasing old queues. Unknown state, pending submissions and a turn changing during the join still require inspection and explicit recovery. Native turn IDs do not prove exclusive control; keep other controlling clients closed.
|
|
81
|
+
|
|
80
82
|
After verified owned-group shutdown and controller release, that conversation becomes managed and inactive without restarting HQ. Resume retains its native identity and history. Unacknowledged input stays uncertain, earlier queued work stays paused, and pending approvals expire. Unconfirmed shutdown or a competing native terminal keeps ownership uncertain; another controlled conversation remains usable. See [Claude connection recovery](docs/recovery.md#claude-connection-recovery).
|
|
81
83
|
|
|
82
84
|
Approval reads return indexed, cursor-paginated pending, answered and expired metadata after reconnect or restart. Sensitive presentation is available only while the exact native request is live. Native permissions require explicit responses; unknown request kinds or scopes are denied. See [native replies and reconnect reads](api/README.md#thread-control-and-live-input).
|
package/api/README.md
CHANGED
|
@@ -93,7 +93,7 @@ After optional `initializeHostStorage` completes, the runtime connects both nati
|
|
|
93
93
|
|
|
94
94
|
The controller holds the state root's `runtime` lock for its lifetime, as [lock lifecycle](#lock-lifecycle) describes. A live, dead, incomplete or unverifiable existing holder prevents another controller from starting, apart from a dead holder the host's `isPreviousRuntimeStopped` check proves stopped. Before deliberate recovery, establish that the inspected host, its worker and native process group have stopped. Runtime shutdown sends interruption requests across the bounded Claude session cohort concurrently, then closes IPC connections, SQLite and owned native processes before releasing the `runtime` lock. Failed cleanup keeps the lock held. A new runtime receives a new epoch.
|
|
95
95
|
|
|
96
|
-
Codex sessions outlive the runtime, because they run in Codex's shared app-server daemon. Shutdown leaves them running: it doesn't interrupt their turns, clean their background terminals or answer a request still waiting on one, and their managed records stay bound to the stopped runtime. At startup, the next runtime rejoins each one that had no action in flight, one at a time in the background. It reads the session's state and latest turn from the daemon, binds the record to its own epoch, then joins with `thread/resume` without settings. A turn still running stays the session's active turn. A turn that finished meanwhile completes its action's receipt, without a `result`, and lets a queued entry waiting on it advance. The daemon sends a still-waiting request again on joining, and it opens as a new approval in the new epoch.
|
|
96
|
+
Codex sessions outlive the runtime, because they run in Codex's shared app-server daemon. Shutdown leaves them running: it doesn't interrupt their turns, clean their background terminals or answer a request still waiting on one, and their managed records stay bound to the stopped runtime. At startup, the next runtime rejoins each one that had no action in flight, one at a time in the background. It reads the session's state and latest turn from the daemon, binds the record to its own epoch, then joins with `thread/resume` without settings. A turn still running stays the session's active turn. A turn that finished meanwhile completes its action's receipt, without a `result`, and lets a queued entry waiting on it advance. The daemon sends a still-waiting request again on joining, and it opens as a new approval in the new epoch. If the verified latest turn changed, the runtime restores control of that previously managed identity without assigning its completion to the earlier action or releasing earlier queued input. This also covers native daemon recovery continuations. Native turn IDs do not establish exclusive control or distinguish another client's turn, so competing controllers must remain closed. A session that cannot be verified or whose turn changes during the join stays uncertain for explicit recovery. A crash leaves the same bound records, so those sessions are rejoined too. A restored snapshot marks every session uncertain, so it never rejoins one. Claude sessions are processes the runtime owns: their turns stop with it, and they wait inactive for an explicit resume.
|
|
97
97
|
|
|
98
98
|
One Codex connection carries every managed Codex session, so a message the runtime can't validate never fails it. A notification about items, text deltas, token usage or a session's status that fails validation is dropped, and a session the runtime controls reports a gap in its live window; a status newer than the runtime knows makes the session `unknown`. A message over 33,554,432 bytes, including its continuation fragments, is skipped through its final fragment without being buffered; a request whose response was skipped fails at its 30-second deadline. A turn start, turn end or approval resolution that fails validation, or a skipped message, whose session can't be known so every session the runtime controls is affected, is made up for by reading the session from the daemon, one session at a time and outside the order other sessions' events keep:
|
|
99
99
|
|
|
@@ -293,13 +293,13 @@ Send `{ kind: 'action', action: { id, runtimeEpoch, command } }`. Generate one U
|
|
|
293
293
|
|
|
294
294
|
Message and queue input is a closed union: `{ kind: 'text', text }` or `{ kind: 'skill', skillId, arguments }`. Text is nonempty and at most 65,536 characters; skill arguments may be empty and cap at 16,384 characters. The envelope's UTF-8 limit still applies. A selected skill is resolved through the target thread's current native catalog before admission. Unavailable, missing or disabled selections cannot dispatch. Normal text needs no catalog read. Steering retains its `text` field and exact active-turn target, adding only optional top-level `files`. Text-only steers remain unchanged; skills and turn settings cannot be steered.
|
|
295
295
|
|
|
296
|
-
Names use lowercase ASCII letters, digits and hyphens, start with a letter or digit, and have at most 64 characters, the public `MAX_THREAD_NAME_LENGTH` from `jg-agent-hq/contracts`. The same bound applies to create, adopt, rename and managed-thread responses. Names are unique without regard to case in one state directory. Creation and adoption resolve collisions atomically with ordinal suffixes such as `build-usage-2`, truncating the base to keep the complete name within 64 characters. Explicit rename rejects an occupied or pending name. Provider/native-session pairs remain unique. At most 32 native sessions are controlled concurrently; close idle sessions to release capacity. Native discovery remains independent of that limit. Confirm that other native CLI controllers are closed before adoption, resume or recovery. An unloaded native status cannot prove another CLI has stopped. The runtime provides exclusive coordination within one canonical state directory; it does not impose a global lock on independent CLIs. Recovery
|
|
296
|
+
Names use lowercase ASCII letters, digits and hyphens, start with a letter or digit, and have at most 64 characters, the public `MAX_THREAD_NAME_LENGTH` from `jg-agent-hq/contracts`. The same bound applies to create, adopt, rename and managed-thread responses. Names are unique without regard to case in one state directory. Creation and adoption resolve collisions atomically with ordinal suffixes such as `build-usage-2`, truncating the base to keep the complete name within 64 characters. Explicit rename rejects an occupied or pending name. Provider/native-session pairs remain unique. At most 32 native sessions are controlled concurrently; close idle sessions to release capacity. Native discovery remains independent of that limit. Confirm that other native CLI controllers are closed before adoption, resume or recovery. An unloaded native status cannot prove another CLI has stopped. The runtime provides exclusive coordination within one canonical state directory; it does not impose a global lock on independent CLIs. Recovery requires inspected ownership evidence and a stopped producing runtime, except confirmed resume of a known quarantined Codex identity with no action in flight, which the current runtime can recover.
|
|
297
297
|
|
|
298
298
|
Version 13 expands the producer contract: a 12.x consumer's strict 32-character schema rejects a response containing a longer managed name. Run matching runtime and consumer releases. Storage remains compatible with 12.0.1, but a package downgrade first requires shortening all longer managed names with supported rename actions and resolving collisions; see [package downgrade](../docs/recovery.md#package-downgrade).
|
|
299
299
|
|
|
300
300
|
Codex may keep an idle native thread loaded after `thread/unsubscribe`, as when a terminal still holds it. An explicitly confirmed resume may reacquire that thread when its known managed control is inactive and managed, without settings overrides. Ordinary resume still refuses active native threads, uncertain managed ownership and already controlled idle sessions.
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
Explicit `thread-recover` with `recovery: { kind: 'resume' }` can rejoin a quarantined managed record's known Codex identity in the current runtime without restarting HQ, whether unloaded or still loaded idle or active. No action may remain in flight. The operator must inspect its ownership evidence and stop competing controllers that could submit work. HQ reads its current native turn, binds it before joining so reissued approvals find their turn, then verifies the same turn again before acknowledging recovery. It changes no settings, sends no input, leaves earlier queued entries paused and does not resolve uncertain input receipts. Unknown execution state, a mismatched workspace/identity or a changed turn refuses recovery. Healthy ownership and pending dispatches remain ineligible. Earlier queued receipts retain this recovery action as `relatedActionId`; completion and later automatic reconnects leave those entries paused until explicitly sent or cancelled. Recovery that attaches an identity after uncertain creation and ordinary adoption retain their existing unloaded-session checks.
|
|
303
303
|
|
|
304
304
|
Receipts separate `delivery` (`queued`, `submitted`, `acknowledged`, `uncertain`, `failed`, `canceled`) from nullable native turn `completion` (`completed`, `failed`, `interrupted`). Acknowledgement means the exact native request was accepted, not that the turn or tool completed. Permission replies remain submitted after a pipe write and become acknowledged only when Codex resolves the exact native request or Claude returns a tool-result block for the exact tool-use identity. Claude cancellation expires the prompt and leaves an unacknowledged written reply uncertain. Resolution does not prove a tool ran. The receipt includes managed and native identity, its nullable `provider`, digest, timestamps, safe failure classification and optional related action. Its `phase` is the native step the action takes now: `create`, `resume`, `name`, `turn`, `steer`, `interrupt`, `clean`, `close`, `delete` or `reply`. A create continues with `name` once its session exists, and with `turn` when it carries a first input; a close's `interrupt` continues with `clean` once the turn ends, and its `clean` with `close`; a deletion of a session the runtime runs takes `clean` and `close` before `delete`. An action that sends nothing native, such as queued input before it is sent, has none. Only selected receipts expose `nativeThreadId`, the native session of the action's thread once the runtime records it, undelivered `queuedInput` and the nullable complete native `result`; collection reads omit all three. Queued input retains prepared text, native skill identity, content-bound file references and explicit turn settings, never file bytes or skill content. It is cleared after delivery acknowledgement or cancellation.
|
|
305
305
|
|
|
@@ -185,9 +185,9 @@ export const createAdmission = (context, dispatcher) => {
|
|
|
185
185
|
const isKnownCodexRecovery = command.kind === 'thread-recover' &&
|
|
186
186
|
command.recovery.kind === 'resume' &&
|
|
187
187
|
thread.provider === 'codex' &&
|
|
188
|
-
!target.canAdopt;
|
|
188
|
+
(!target.canAdopt || thread.runtimeEpoch === epoch);
|
|
189
189
|
if (isKnownCodexRecovery) {
|
|
190
|
-
if (thread.ownership !== 'uncertain'
|
|
190
|
+
if (thread.ownership !== 'uncertain')
|
|
191
191
|
conflict();
|
|
192
192
|
if (!control.readReattachment || !control.reattachThread)
|
|
193
193
|
capabilityUnavailable();
|
|
@@ -196,7 +196,7 @@ export const createAdmission = (context, dispatcher) => {
|
|
|
196
196
|
if (read.thread.nativeId !== nativeId ||
|
|
197
197
|
(await resolveWorkspaceTarget(read.thread.workspaceRoot, roots)) !==
|
|
198
198
|
thread.workspaceRoot ||
|
|
199
|
-
!['idle', 'active'].includes(read.thread.nativeState))
|
|
199
|
+
!['notLoaded', 'idle', 'active'].includes(read.thread.nativeState))
|
|
200
200
|
conflict();
|
|
201
201
|
prepared.recoveryTurn = read.latestTurn && {
|
|
202
202
|
nativeTurnId: read.latestTurn.nativeId,
|
|
@@ -199,7 +199,13 @@ export class ControlAdmission extends ControlModel {
|
|
|
199
199
|
thread.workspace_root === proof.workspaceRoot;
|
|
200
200
|
if (proof && !isQuarantinedClose)
|
|
201
201
|
this._conflict();
|
|
202
|
-
|
|
202
|
+
const isVerifiedCodexRecovery = command.kind === 'thread-recover' &&
|
|
203
|
+
command.recovery.kind === 'resume' &&
|
|
204
|
+
thread.provider === 'codex' &&
|
|
205
|
+
thread.native_id !== null &&
|
|
206
|
+
thread.native_id === prepared.nativeId &&
|
|
207
|
+
prepared.recoveryTurn !== undefined;
|
|
208
|
+
this.__requireControl(isQuarantinedClose ? 'attached' : rule.control, thread, isVerifiedCodexRecovery);
|
|
203
209
|
if (isQuarantinedClose && thread.pending_action_id)
|
|
204
210
|
this._conflict();
|
|
205
211
|
if (rule.requiresNoPendingAction && thread.pending_action_id)
|
|
@@ -247,7 +253,8 @@ export class ControlAdmission extends ControlModel {
|
|
|
247
253
|
const isRunning = latest?.state === 'running';
|
|
248
254
|
// bind before joining so a reissued native request finds the exact active turn
|
|
249
255
|
this._statements.run('UPDATE agent_hq_thread SET active_turn_id = ?, last_turn_id = ?, last_turn_state = ?, state = ? WHERE id = ?', isRunning ? latest.nativeTurnId : null, latest && !isRunning ? latest.nativeTurnId : thread.last_turn_id, latest && !isRunning ? latest.state : thread.last_turn_state, latest?.state ?? 'idle', threadId);
|
|
250
|
-
|
|
256
|
+
// retain the pause across later completions and automatic reconnects in this runtime
|
|
257
|
+
this._statements.run("UPDATE agent_hq_action SET queue_ready = 0, related_action_id = ?, updated_at = ? WHERE thread_id = ? AND delivery = 'queued'", action.id, now, threadId);
|
|
251
258
|
}
|
|
252
259
|
if (isCreating)
|
|
253
260
|
this._statements.run('UPDATE agent_hq_action SET requested_name = ? WHERE id = ?', thread.name, action.id);
|
|
@@ -361,7 +368,7 @@ export class ControlAdmission extends ControlModel {
|
|
|
361
368
|
}
|
|
362
369
|
}
|
|
363
370
|
/** Requires the control the rule names over the thread. */
|
|
364
|
-
__requireControl(control, thread) {
|
|
371
|
+
__requireControl(control, thread, isVerifiedCodexRecovery = false) {
|
|
365
372
|
if (control === null)
|
|
366
373
|
return;
|
|
367
374
|
if (control === 'owned') {
|
|
@@ -388,7 +395,8 @@ export class ControlAdmission extends ControlModel {
|
|
|
388
395
|
!thread.native_id)
|
|
389
396
|
this._conflict();
|
|
390
397
|
}
|
|
391
|
-
else if (thread.ownership !== 'uncertain' ||
|
|
398
|
+
else if (thread.ownership !== 'uncertain' ||
|
|
399
|
+
(thread.runtime_epoch === this._epoch && !isVerifiedCodexRecovery))
|
|
392
400
|
this._conflict();
|
|
393
401
|
}
|
|
394
402
|
__requireIdle(thread) {
|
|
@@ -46,9 +46,9 @@ export declare class ControlLifecycle extends ControlModel {
|
|
|
46
46
|
/**
|
|
47
47
|
* Binds a kept or reconnecting session to this runtime, as its native process reports
|
|
48
48
|
* it before the runtime rejoins it. A turn that finished meanwhile completes its action and lets
|
|
49
|
-
* the session's queued input advance, which this runtime then delivers. A
|
|
50
|
-
*
|
|
51
|
-
* uncertain
|
|
49
|
+
* the session's queued input advance, which this runtime then delivers. A different verified turn
|
|
50
|
+
* restores control without completing the earlier action or releasing its queued input.
|
|
51
|
+
* Unverifiable native state stays uncertain.
|
|
52
52
|
* @returns The thread and whether its queue may advance, or null when it is no longer one to rejoin.
|
|
53
53
|
* @throws
|
|
54
54
|
* - JG_AGENT_HQ_ACTION_CONFLICT: The HQ action conflicts with its recorded state
|
|
@@ -107,9 +107,9 @@ export class ControlLifecycle extends ControlModel {
|
|
|
107
107
|
/**
|
|
108
108
|
* Binds a kept or reconnecting session to this runtime, as its native process reports
|
|
109
109
|
* it before the runtime rejoins it. A turn that finished meanwhile completes its action and lets
|
|
110
|
-
* the session's queued input advance, which this runtime then delivers. A
|
|
111
|
-
*
|
|
112
|
-
* uncertain
|
|
110
|
+
* the session's queued input advance, which this runtime then delivers. A different verified turn
|
|
111
|
+
* restores control without completing the earlier action or releasing its queued input.
|
|
112
|
+
* Unverifiable native state stays uncertain.
|
|
113
113
|
* @returns The thread and whether its queue may advance, or null when it is no longer one to rejoin.
|
|
114
114
|
* @throws
|
|
115
115
|
* - JG_AGENT_HQ_ACTION_CONFLICT: The HQ action conflicts with its recorded state
|
|
@@ -124,30 +124,39 @@ export class ControlLifecycle extends ControlModel {
|
|
|
124
124
|
const now = Date.now();
|
|
125
125
|
const latest = input.latestTurn;
|
|
126
126
|
const isRunning = latest?.state === 'running';
|
|
127
|
-
|
|
128
|
-
(isRunning && thread.active_turn_id === null)
|
|
127
|
+
const hasChangedTurn = (latest?.nativeTurnId ?? null) !== (thread.active_turn_id ?? thread.last_turn_id) ||
|
|
128
|
+
(isRunning && thread.active_turn_id === null);
|
|
129
|
+
if (hasChangedTurn && latest === null) {
|
|
129
130
|
if (!input.isReconnect)
|
|
130
131
|
this.__quarantine(thread.id, now);
|
|
131
132
|
return { thread: this._managedThread(thread.id), canDispatchQueued: false };
|
|
132
133
|
}
|
|
133
134
|
this._availableSlot();
|
|
134
135
|
// the turn HQ left running, when it has finished since
|
|
135
|
-
const finished = thread.active_turn_id !== null && latest && latest.state !== 'running'
|
|
136
|
+
const finished = !hasChangedTurn && thread.active_turn_id !== null && latest && latest.state !== 'running'
|
|
136
137
|
? { nativeTurnId: latest.nativeTurnId, state: latest.state }
|
|
137
138
|
: null;
|
|
138
|
-
const state =
|
|
139
|
-
?
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
const state = hasChangedTurn
|
|
140
|
+
? latest.state
|
|
141
|
+
: isRunning
|
|
142
|
+
? thread.state === 'stopping'
|
|
143
|
+
? 'stopping'
|
|
144
|
+
: 'running'
|
|
145
|
+
: (finished?.state ??
|
|
146
|
+
(input.isReconnect ? (thread.last_turn_state ?? 'idle') : thread.state));
|
|
147
|
+
this._statements.run("UPDATE agent_hq_thread SET ownership = 'managed', runtime_epoch = ?, active_turn_id = ?, last_turn_id = ?, last_turn_state = ?, state = ?, updated_at = ? WHERE id = ?", this._epoch, isRunning ? latest.nativeTurnId : null, hasChangedTurn && latest && !isRunning
|
|
148
|
+
? latest.nativeTurnId
|
|
149
|
+
: (finished?.nativeTurnId ?? thread.last_turn_id), hasChangedTurn && latest && !isRunning
|
|
150
|
+
? latest.state
|
|
151
|
+
: (finished?.state ?? thread.last_turn_state), state, now, thread.id);
|
|
145
152
|
this._statements.run("UPDATE agent_hq_action SET runtime_epoch = ?, updated_at = ? WHERE thread_id = ? AND delivery = 'queued'", this._epoch, now, thread.id);
|
|
153
|
+
if (hasChangedTurn)
|
|
154
|
+
this._statements.run("UPDATE agent_hq_action SET queue_ready = 0 WHERE thread_id = ? AND delivery = 'queued'", thread.id);
|
|
146
155
|
const canDispatchQueued = finished?.state === 'completed' && thread.state !== 'stopping';
|
|
147
156
|
if (finished) {
|
|
148
157
|
this._statements.run('UPDATE agent_hq_action SET completion = ?, updated_at = ? WHERE thread_id = ? AND native_turn_id = ? AND completion IS NULL', finished.state, now, thread.id, finished.nativeTurnId);
|
|
149
158
|
if (canDispatchQueued)
|
|
150
|
-
this._statements.run("UPDATE agent_hq_action SET queue_ready = 1 WHERE thread_id = ? AND expected_turn_id = ? AND delivery = 'queued'", thread.id, finished.nativeTurnId);
|
|
159
|
+
this._statements.run("UPDATE agent_hq_action SET queue_ready = 1 WHERE thread_id = ? AND expected_turn_id = ? AND delivery = 'queued' AND related_action_id IS NULL", thread.id, finished.nativeTurnId);
|
|
151
160
|
}
|
|
152
161
|
return { thread: this._managedThread(thread.id), canDispatchQueued };
|
|
153
162
|
});
|
|
@@ -114,7 +114,7 @@ export class ControlObservations extends ControlModel {
|
|
|
114
114
|
thread.ownership === 'managed';
|
|
115
115
|
this._statements.run('UPDATE agent_hq_thread SET active_turn_id = NULL, last_turn_id = ?, last_turn_state = ?, state = ?, updated_at = ? WHERE id = ?', observation.nativeTurnId, observation.state, thread.ownership === 'uncertain' ? 'unknown' : observation.state, now, thread.id);
|
|
116
116
|
if (mayAdvance)
|
|
117
|
-
this._statements.run("UPDATE agent_hq_action SET queue_ready = 1 WHERE thread_id = ? AND expected_turn_id = ? AND delivery = 'queued' AND runtime_epoch = ?", thread.id, observation.nativeTurnId, this._epoch);
|
|
117
|
+
this._statements.run("UPDATE agent_hq_action SET queue_ready = 1 WHERE thread_id = ? AND expected_turn_id = ? AND delivery = 'queued' AND runtime_epoch = ? AND related_action_id IS NULL", thread.id, observation.nativeTurnId, this._epoch);
|
|
118
118
|
else
|
|
119
119
|
this._statements.run("UPDATE agent_hq_action SET queue_ready = 0 WHERE thread_id = ? AND delivery = 'queued'", thread.id);
|
|
120
120
|
}
|
package/docs/recovery.md
CHANGED
|
@@ -54,9 +54,9 @@ Async question subscriptions are ephemeral. Recreate the host's `observeAsyncInp
|
|
|
54
54
|
|
|
55
55
|
A quarantined session can still be monitored while a CLI runs it. Native observations update its live state without recovering ownership; the summary keeps uncertain ownership and its existing managed identity. Monitoring sends no input and leaves the control ledger and earlier queued entries unchanged.
|
|
56
56
|
|
|
57
|
-
A shared Codex daemon restart can interrupt every managed Codex session's live connection while HQ stays running. The runtime rechecks only its previously controlled sessions with no action in flight and rejoins
|
|
57
|
+
A shared Codex daemon restart can interrupt every managed Codex session's live connection while HQ stays running. The runtime rechecks only its previously controlled sessions with no action in flight and rejoins verified native turns without changing settings or repeating input. Matching-turn completions advance their waiting queues. A stable changed turn restores control while earlier receipts remain unresolved and earlier queues stay paused, including through later reconnects. Pending submissions are excluded, and unknown state or a turn changing during the join stays uncertain. The same policy applies to previously managed sessions retained at runtime restart; existing uncertain or externally discovered identities are never automatically adopted. Native turn IDs cannot distinguish a daemon continuation from another client's work or establish exclusive control, so keep competing controllers closed. Native command handles may have been lost, so rejoining establishes session control rather than successful command execution. See [runtime lifecycle](../api/README.md#runtime-lifecycle).
|
|
58
58
|
|
|
59
|
-
For a session left uncertain,
|
|
59
|
+
For a known Codex session left uncertain, inspect its native identity and close competing controllers before explicit recovery. The current HQ runtime can recover it once no action remains in flight; restarting HQ is unnecessary. Other recovery modes and providers retain their stopped-producing-runtime requirement. `thread-recover` with `recovery: { kind: 'resume' }` can rejoin its already known Codex identity whether unloaded or still held idle or active. The verified current turn is bound before joining and checked again afterward; no settings or input are sent. Reissued approvals can then be answered explicitly. Earlier queued entries stay paused, uncertain input receipts stay unresolved, and unknown state or a turn changing during the join leaves control uncertain. Never use attach/create to replace a known native identity or replay work to recover control.
|
|
60
60
|
|
|
61
61
|
Quarantined Codex records retain their producing epoch and turn evidence across shutdown. Earlier releases could instead leave a known record managed and inactive after shutdown; inspect that state and use a confirmed `thread-resume` only once its native session is idle or unloaded. Do not change ownership records by hand or replace the identity to bypass the native-state checks.
|
|
62
62
|
|
package/package.json
CHANGED