jg-agent-hq 13.5.7 → 13.5.9
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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 13.5.9
|
|
4
|
+
|
|
5
|
+
- Retain Codex control when the same controller records a valid native recovery turn while rejoining after a connection loss or runtime restart. Reconcile the observed turn instead of quarantining it against the pre-join snapshot.
|
|
6
|
+
- Keep unverified and overlapping turn changes quarantined, earlier receipts unchanged and queued input paused, without repeating input, settings or native joins.
|
|
7
|
+
|
|
8
|
+
## 13.5.8
|
|
9
|
+
|
|
10
|
+
- Keep informational Codex messages in the transcript and out of question observers when their async delivery carries no questions. Preserve validation for question bundles.
|
|
11
|
+
|
|
3
12
|
## 13.5.7 — documentation navigation
|
|
4
13
|
|
|
5
14
|
- Keep the package overview concise and route setup, runtime ownership and delivery details to their canonical guides. Runtime behavior and public APIs are unchanged.
|
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. 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
|
|
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 turn that changes during the join is retained only when the same controller's ordered native events already recorded that exact turn and state, with no action in flight. This reconciliation sends no input, repeats no join or events and does not release earlier queued input. Unverified, unobserved or overlapping transitions stay 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
|
|
|
@@ -260,7 +260,7 @@ File timestamps and records do not prove that a native process is idle or a turn
|
|
|
260
260
|
|
|
261
261
|
## Async questions
|
|
262
262
|
|
|
263
|
-
An explicit Codex `agentMessage` with `delivery: 'async'` carries
|
|
263
|
+
An explicit Codex `agentMessage` with `delivery: 'async'` carries `asyncInput` when it includes a non-null `questions` field. The same metadata is available in live items, item details and every evidence fragment. Async messages with a missing or null `questions` field are informational notices. Their text remains visible in the transcript, and question observers receive no item for them. Text or a `questions` field alone never establishes async semantics.
|
|
264
264
|
|
|
265
265
|
Available metadata is `{ delivery: 'async', state: 'available', questions }`. Each ordered question has a nonempty `title` and optional ordered string `options`. Native `options: null` is normalized to an omitted `options` field for free-text questions. Question and choice strings retain their exact content, up to 8192 UTF-16 code units each, with at most 32 questions and 32 choices per question. The entire normalized `asyncInput` must fit `MAX_ASYNC_INPUT_BYTES` (32768 serialized UTF-8 bytes, including JSON escaping). Additive native fields are tolerated. Malformed contracts retain ordinary preview text and `{ delivery: 'async', state: 'unavailable', reason: 'invalid' }`; valid shapes over the byte budget use `reason: 'too-large'`. Choices are never shortened to fit a response. Evidence fitting accounts for metadata before selecting its text chunk; live memory accounting includes the complete serialized item, and saved/live reconciliation requires matching async metadata.
|
|
266
266
|
|
|
@@ -493,6 +493,8 @@ The operation matrix describes the implemented native interfaces and their expli
|
|
|
493
493
|
|
|
494
494
|
On 2026-11-10, Linux with Node.js 24.15.0 and Codex 0.167.0 qualified the built public async-input API in an owned disposable workspace. Actual `request_user_input_async` emission retained the exact question choices and managed/native/turn/item identities, matched saved native history, and left the ordinary `ASYNC_QUALIFICATION_FINAL` result intact. Terminating only that runtime's owned Codex proxy produced output-gap/reconnect signals; bounded native history recovered the same question without inference or input replay. The owned session was deleted and the runtime closed. Fixture tests additionally cover invalid/oversized metadata, evidence fitting, observer isolation and shutdown; macOS and other CLI/model configurations require separate native evidence.
|
|
495
495
|
|
|
496
|
+
The informational-notice fix in 13.5.8 was checked through the built public API on Linux with Node.js 24.15.0 and Codex 0.170.0. A native informational notice retained its transcript text and produced no question observation. A genuine asynchronous question reached the observer with its native item identity, appeared in saved history, and the ordinary final response was retained. The disposable native session was deleted and its controller closed.
|
|
497
|
+
|
|
496
498
|
On 2026-11-07, Codex 0.167.0 consumed image and labeled text input through `turn/steer` in the running turn. Claude Code 2.1.319 with claude-opus-5-5 and normal `auto` permissions consumed text/PDF document blocks at turn start, and image plus labeled text blocks in the original running turn. A native PDF steer was dropped, so it is excluded from Claude's steer media list. The repaired runtime journey verified exact browser/action/source identity, original first-text hash, separate persisted prompt blocks, unchanged saved image bytes, live/history reconciliation, and provenance after restart without resending. The queued prompt's graph UUID differs from its input's source UUID. Its projection rebuild was also checked against the retained real transcript and an older cached index. These checks establish the observed native shapes and provider versions, without using an origin override or changing turn-start encoding.
|
|
497
499
|
|
|
498
500
|
| Area | Executed evidence | Boundary |
|
|
@@ -57,12 +57,38 @@ export const createReattach = (context, dispatcher, events) => {
|
|
|
57
57
|
return;
|
|
58
58
|
own(thread.provider, nativeId);
|
|
59
59
|
isOwned = true;
|
|
60
|
+
const liveKey = key(thread.provider, nativeId);
|
|
61
|
+
const owner = context.controlled.get(liveKey);
|
|
60
62
|
const joined = await control.reattachThread(`${randomUUID()}:reattach`, nativeId, thread.workspaceRoot);
|
|
61
63
|
assertKnownTurn(joined);
|
|
62
64
|
const turnId = bound.thread.activeTurnId;
|
|
63
65
|
const latest = joined.latestTurn;
|
|
64
|
-
if ((latest?.nativeId ?? null) !== (read.latestTurn?.nativeId ?? null))
|
|
65
|
-
|
|
66
|
+
if ((latest?.nativeId ?? null) !== (read.latestTurn?.nativeId ?? null)) {
|
|
67
|
+
if (!latest)
|
|
68
|
+
agentUnavailable();
|
|
69
|
+
// Codex can interrupt the old turn and start its recovery while the join is in flight.
|
|
70
|
+
// Accept only the transition this same controller already recorded, without replaying it.
|
|
71
|
+
await state.lane;
|
|
72
|
+
const current = await store.call('reads', 'getThread', thread.id);
|
|
73
|
+
const recorded = await store.call('reads', 'getTurnRecord', thread.provider, nativeId);
|
|
74
|
+
const hasObservedTurn = latest.state === 'running'
|
|
75
|
+
? current?.activeTurnId === latest.nativeId &&
|
|
76
|
+
recorded?.activeTurnId === latest.nativeId
|
|
77
|
+
: current?.activeTurnId === null &&
|
|
78
|
+
current.state === latest.state &&
|
|
79
|
+
recorded?.lastTurnId === latest.nativeId;
|
|
80
|
+
if (state.isClosing ||
|
|
81
|
+
state.isUnavailable ||
|
|
82
|
+
context.blockedProviders.has(thread.provider) ||
|
|
83
|
+
context.controlled.get(liveKey) !== owner ||
|
|
84
|
+
current?.ownership !== 'managed' ||
|
|
85
|
+
current.runtimeEpoch !== epoch ||
|
|
86
|
+
current.nativeId !== nativeId ||
|
|
87
|
+
recorded?.hasPendingAction !== false ||
|
|
88
|
+
!hasObservedTurn)
|
|
89
|
+
agentUnavailable();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
66
92
|
if (turnId && latest?.nativeId === turnId && latest.state !== 'running') {
|
|
67
93
|
const { state: turnState } = latest;
|
|
68
94
|
live.completeTurn(key(thread.provider, nativeId), turnId);
|
|
@@ -74,9 +74,9 @@ const MessageSchema = z.object({ text: z.string() });
|
|
|
74
74
|
const NativeAsyncQuestionSchema = AsyncQuestionSchema.extend({
|
|
75
75
|
options: AsyncQuestionSchema.shape.options.nullable(),
|
|
76
76
|
}).transform(({ options, ...question }) => (options == null ? question : { ...question, options }));
|
|
77
|
-
/**
|
|
77
|
+
/** Normalizes async question bundles and leaves informational notices as transcript messages. */
|
|
78
78
|
const toAsyncInput = (item) => {
|
|
79
|
-
if (item.type !== 'agentMessage' || item.delivery !== 'async')
|
|
79
|
+
if (item.type !== 'agentMessage' || item.delivery !== 'async' || item.questions == null)
|
|
80
80
|
return undefined;
|
|
81
81
|
const questions = z.array(NativeAsyncQuestionSchema).min(1).max(32).safeParse(item.questions);
|
|
82
82
|
if (!questions.success)
|
|
@@ -210,6 +210,7 @@ export const toHistoryItem = ({ turnId, item, startedAtMs, completedAtMs }, full
|
|
|
210
210
|
const last = text.charCodeAt(end - 1);
|
|
211
211
|
if (end < text.length && last >= 0xd800 && last <= 0xdbff)
|
|
212
212
|
end -= 1;
|
|
213
|
+
const asyncInput = toAsyncInput(item);
|
|
213
214
|
return parseNative(HistoryItemSchema, {
|
|
214
215
|
nativeId: item.id,
|
|
215
216
|
turnId,
|
|
@@ -218,9 +219,7 @@ export const toHistoryItem = ({ turnId, item, startedAtMs, completedAtMs }, full
|
|
|
218
219
|
provenance: nativeProvenance(kind, kind === 'user-message' && typeof item.clientId === 'string' ? item.clientId : null, inputText),
|
|
219
220
|
text: text.slice(0, end),
|
|
220
221
|
isTruncated: end < text.length,
|
|
221
|
-
...(
|
|
222
|
-
? { asyncInput: toAsyncInput(item) }
|
|
223
|
-
: {}),
|
|
222
|
+
...(asyncInput ? { asyncInput } : {}),
|
|
224
223
|
// a Codex item holds its call and its result together
|
|
225
224
|
callId: null,
|
|
226
225
|
outcome,
|
package/docs/recovery.md
CHANGED
|
@@ -54,7 +54,7 @@ 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 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
|
|
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. A turn changing during the join retains control only when the same controller has already recorded that exact native transition and state, with no action in flight. This reconciliation repeats no native operation or events and leaves earlier queued input paused. Unknown, unobserved or overlapping transitions stay 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
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
|
|
package/package.json
CHANGED