@agfpd/iapeer 0.2.56 → 0.2.57
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/package.json +1 -1
- package/src/lifecycle/index.ts +16 -0
package/package.json
CHANGED
package/src/lifecycle/index.ts
CHANGED
|
@@ -1001,6 +1001,22 @@ export async function wakeOrSpawn(args: WakeArgs, deps: WakeDeps = {}): Promise<
|
|
|
1001
1001
|
const firstMessage = composeFirstMessage(cwd, args.task, fresh)
|
|
1002
1002
|
const result = await launch(spec, adapter, firstMessage, launchCfg)
|
|
1003
1003
|
if (result.status === 'FAILED') {
|
|
1004
|
+
// enroll-on-FAILED (0.2.57): launch can return FAILED on a ready-gate false-negative
|
|
1005
|
+
// (model-did-not-process-task) while the tmux session + its process actually SURVIVE —
|
|
1006
|
+
// observed live (ttlverify, 13.06). Since 0.2.55 removed the self-TTL, such a remnant
|
|
1007
|
+
// would be an UNBOUNDED orphan: no .session → invisible to superviseTick's idle-reap,
|
|
1008
|
+
// and no wall-clock backstop. If the session is in fact ALIVE, enroll it so the
|
|
1009
|
+
// activity-aware idle-reap stays the UNIVERSAL bound (a genuinely wedged session is
|
|
1010
|
+
// idle-reaped after idleSecs; a false-negative-but-working one keeps working and is
|
|
1011
|
+
// reaped only when truly idle, and its next message reaches it via the has-session fast
|
|
1012
|
+
// path above). We do NOT flip to READY — the wake DID fail its ready-gate, the caller
|
|
1013
|
+
// must still hear FAILED; we only make the live remnant supervised. Best-effort: a write
|
|
1014
|
+
// hiccup must not mask the original FAILED reason.
|
|
1015
|
+
if (sessionAlive(sock, identity)) {
|
|
1016
|
+
try {
|
|
1017
|
+
writeSessionState(cfg, { identity, runtime, personality: args.personality, cwd, wokeAt: Date.now() })
|
|
1018
|
+
} catch { /* keep the original FAILED reason — enroll is best-effort */ }
|
|
1019
|
+
}
|
|
1004
1020
|
return { status: 'FAILED', woke: false, runtime, reason: result.reason }
|
|
1005
1021
|
}
|
|
1006
1022
|
// The session is up and the message delivered. Recording supervise-state must not
|