instar 1.3.212 → 1.3.213
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +2 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/core/SessionManager.d.ts +24 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +79 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/monitoring/StaleSessionBackstop.d.ts +15 -0
- package/dist/monitoring/StaleSessionBackstop.d.ts.map +1 -1
- package/dist/monitoring/StaleSessionBackstop.js +16 -4
- package/dist/monitoring/StaleSessionBackstop.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +3 -3
- package/upgrades/1.3.213.md +50 -0
- package/upgrades/side-effects/codex-wedged-job-cpu-detection.md +118 -0
|
@@ -34,6 +34,7 @@ export const DEFAULT_STALE_BACKSTOP_OPTIONS = {
|
|
|
34
34
|
unverifiableEscalateMinutes: 30,
|
|
35
35
|
indeterminateEscalateCount: 15,
|
|
36
36
|
progressFloorBytes: 512,
|
|
37
|
+
cpuFloorSeconds: 1,
|
|
37
38
|
};
|
|
38
39
|
export class StaleSessionBackstop {
|
|
39
40
|
deps;
|
|
@@ -148,11 +149,22 @@ export class StaleSessionBackstop {
|
|
|
148
149
|
cur.transcriptTailHash != null && cur.transcriptTailHash !== prev.transcriptTailHash) {
|
|
149
150
|
return true;
|
|
150
151
|
}
|
|
151
|
-
// (ii)
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
|
|
152
|
+
// (ii) Real work by the main process.
|
|
153
|
+
// For JOB sessions (which have no legitimate-idle state — a job runs to
|
|
154
|
+
// completion) require actual CPU USED in the interval: the cpu-seconds
|
|
155
|
+
// delta past a small floor. A wedged-but-alive job (process up, 0% CPU)
|
|
156
|
+
// reads as no-progress here, where the old existence-based check
|
|
157
|
+
// false-positived it as "active" (the 12h-undetected codex-job wedge).
|
|
158
|
+
// Conversational sessions keep the existence-based check, which correctly
|
|
159
|
+
// exempts a legitimately-idle session that happens to have a background
|
|
160
|
+
// process. `undefined` (uninspectable) is never progress.
|
|
161
|
+
if (cur.isJobSession) {
|
|
162
|
+
if (cur.descendantCpuSeconds - prev.descendantCpuSeconds > this.opts.cpuFloorSeconds)
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
else if (cur.mainProcessActive === true) {
|
|
155
166
|
return true;
|
|
167
|
+
}
|
|
156
168
|
// (iii) Positive-idle / prompt state changed.
|
|
157
169
|
if (cur.idleStateToken !== prev.idleStateToken)
|
|
158
170
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaleSessionBackstop.js","sourceRoot":"","sources":["../../src/monitoring/StaleSessionBackstop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"StaleSessionBackstop.js","sourceRoot":"","sources":["../../src/monitoring/StaleSessionBackstop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AA8DH,MAAM,CAAC,MAAM,8BAA8B,GAAyB;IAClE,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,GAAG;IACpB,2BAA2B,EAAE,EAAE;IAC/B,0BAA0B,EAAE,EAAE;IAC9B,kBAAkB,EAAE,GAAG;IACvB,eAAe,EAAE,CAAC;CACnB,CAAC;AAUF,MAAM,OAAO,oBAAoB;IACd,IAAI,CAAoB;IACxB,IAAI,CAAuB;IAC3B,GAAG,CAAe;IAC3B,KAAK,GAA0B,IAAI,CAAC;IACpC,GAAG,GAAG,IAAI,GAAG,EAAe,CAAC;IAC7B,iBAAiB,GAAG,KAAK,CAAC;IAC1B,oBAAoB,GAAG,CAAC,CAAC;IAEjC,YAAY,IAAuB,EAAE,IAAoC;QACvE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAA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;QAC7E,+DAA+D;QAC/D,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;YACrB,IAAI,GAAG,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,OAAO,IAAI,CAAC;QACpG,CAAC;aAAM,IAAI,GAAG,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,8CAA8C;QAC9C,IAAI,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,OAAgB,EAAE,CAAM,EAAE,MAAc;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;YAC7B,EAAE,EAAE,SAAS,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE;YACzC,KAAK,EAAE,YAAY,OAAO,CAAC,IAAI,2BAA2B;YAC1D,OAAO,EACL,GAAG,MAAM,kFAAkF;kBACzF,2EAA2E;YAC/E,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-06-03T06:
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-06-03T06:53:36.275Z",
|
|
5
|
+
"instarVersion": "1.3.213",
|
|
6
6
|
"entryCount": 195,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -1482,7 +1482,7 @@
|
|
|
1482
1482
|
"type": "subsystem",
|
|
1483
1483
|
"domain": "sessions",
|
|
1484
1484
|
"sourcePath": "src/core/SessionManager.ts",
|
|
1485
|
-
"contentHash": "
|
|
1485
|
+
"contentHash": "46706859e45b4bc503947a54338dbea94672e8bb1fd178afba517052d5ad4eb7",
|
|
1486
1486
|
"since": "2025-01-01"
|
|
1487
1487
|
},
|
|
1488
1488
|
"subsystem:auto-updater": {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
A scheduled codex job (`codex exec --json`) can wedge: the process stays alive but
|
|
9
|
+
makes no progress — 0% CPU, no output. One such job sat wedged ~12h undetected. The
|
|
10
|
+
StaleSessionBackstop (which raises a "stale but unkillable" attention item, never
|
|
11
|
+
kills) missed it because its forward-progress check used process **existence**:
|
|
12
|
+
`hasActiveProcesses` walks descendant processes and returns true if any non-baseline
|
|
13
|
+
child is alive — which a wedged-but-alive job is. So the backstop read it as
|
|
14
|
+
"active" and never escalated. (Conversational claude sessions are saved by transcript
|
|
15
|
+
growth, so only jobs — whose codex transcript doesn't resolve — were exposed.)
|
|
16
|
+
|
|
17
|
+
The fix gives the backstop a real CPU signal: `SessionManager.descendantCpuSeconds`
|
|
18
|
+
reads each non-baseline descendant's accumulated CPU time, and the backstop compares
|
|
19
|
+
the delta across its two snapshots — real CPU *used* in the interval, not mere
|
|
20
|
+
existence. This is scoped to **job sessions** (which have no legitimate-idle state):
|
|
21
|
+
a job that uses no CPU between snapshots reads as no-progress and escalates.
|
|
22
|
+
Conversational sessions keep the existing existence-based check, so a legitimately-idle
|
|
23
|
+
session with a background process is *not* falsely flagged.
|
|
24
|
+
|
|
25
|
+
## What to Tell Your User
|
|
26
|
+
|
|
27
|
+
If one of my scheduled background jobs ever freezes — alive but doing nothing — I'll
|
|
28
|
+
now actually notice it and flag it for attention, instead of mistaking "the process
|
|
29
|
+
is still running" for "it's making progress." Before, a job could sit stuck for hours
|
|
30
|
+
unseen; now a job that stops using any CPU gets surfaced. This only adds an
|
|
31
|
+
attention notice — it never kills anything — and it doesn't change how I treat your
|
|
32
|
+
normal interactive sessions.
|
|
33
|
+
|
|
34
|
+
## Summary of New Capabilities
|
|
35
|
+
|
|
36
|
+
- The stale-session backstop now detects a wedged-but-alive **job** (0% CPU, no
|
|
37
|
+
output) and raises its existing attention notice, where it previously read process
|
|
38
|
+
existence as "progress" and stayed silent.
|
|
39
|
+
- New `SessionManager.descendantCpuSeconds` (accumulated CPU-seconds of a session's
|
|
40
|
+
real children) + `parseProcTimeToSeconds` — a CPU-delta progress signal.
|
|
41
|
+
- Scoped to job sessions only; conversational sessions are unchanged (no new
|
|
42
|
+
false-positives on idle-with-a-background-process). Never kills — attention-only.
|
|
43
|
+
|
|
44
|
+
## Evidence
|
|
45
|
+
|
|
46
|
+
- 19 tests: `stale-session-backstop` (13 — incl. wedged-job→escalate, busy-job→no,
|
|
47
|
+
conversational-idle-with-bg→no-regression) + `parseProcTimeToSeconds` (6, covering
|
|
48
|
+
`MM:SS` / `MM:SS.ss` / `HH:MM:SS` / `DD-HH:MM:SS`). `tsc --noEmit` + `pnpm build` clean.
|
|
49
|
+
- The escalation path is unchanged (still attention-only, never a kill); only the
|
|
50
|
+
forward-progress test gains a CPU-delta requirement for job sessions.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Side-Effects Review — Codex wedged-job CPU-stall detection
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `codex-wedged-job-cpu-detection`
|
|
4
|
+
**Date:** `2026-06-03`
|
|
5
|
+
**Author:** `Echo`
|
|
6
|
+
**Second-pass reviewer:** `Echo (self) — Tier-1; the regression analysis below is the load-bearing part`
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
StaleSessionBackstop's `hasForwardProgress` gains a CPU-delta progress signal for
|
|
11
|
+
**job sessions**, replacing the existence-based `mainProcessActive` check for them.
|
|
12
|
+
A wedged-but-alive codex job (0% CPU) now reads as no-progress and triggers the
|
|
13
|
+
existing attention escalation (never a kill). Files: `SessionManager.ts`
|
|
14
|
+
(`descendantCpuSeconds` + `parseProcTimeToSeconds`), `StaleSessionBackstop.ts`
|
|
15
|
+
(ProgressSnapshot fields `descendantCpuSeconds`/`isJobSession`, the job-scoped
|
|
16
|
+
`hasForwardProgress` branch, `cpuFloorSeconds` option), `server.ts` (snapshot
|
|
17
|
+
populates the two fields). The only decision point: *is this session making forward
|
|
18
|
+
progress* — and the change narrows what counts as progress for jobs.
|
|
19
|
+
|
|
20
|
+
## Decision-point inventory
|
|
21
|
+
|
|
22
|
+
- `StaleSessionBackstop.hasForwardProgress` (ii) — modify — for job sessions, require
|
|
23
|
+
cpu-seconds delta > floor instead of process existence.
|
|
24
|
+
- No message block/allow surface. No kill/terminate surface (the backstop has none —
|
|
25
|
+
asserted by an existing structural test).
|
|
26
|
+
|
|
27
|
+
## 1. Over-block
|
|
28
|
+
|
|
29
|
+
No block/allow surface. The analogue ("does it raise a false attention notice?") is
|
|
30
|
+
THE risk and is handled by scoping: the stricter cpu-delta test applies ONLY to job
|
|
31
|
+
sessions (`!!session.jobSlug`). A conversational session that's legitimately idle
|
|
32
|
+
with a background process keeps the existence-based check → not flagged. Verified by
|
|
33
|
+
the `conversational-idle-with-bg → no` test.
|
|
34
|
+
|
|
35
|
+
## 2. Under-block
|
|
36
|
+
|
|
37
|
+
A job that uses *some* CPU between two 120s snapshots (above `cpuFloorSeconds=1`) is
|
|
38
|
+
treated as progressing — so a job that's busy-looping (high CPU, no real output)
|
|
39
|
+
would not be flagged by this signal. That's acceptable: this targets the 0%-CPU
|
|
40
|
+
freeze; a CPU-burning runaway is a different detector's concern (and would show on
|
|
41
|
+
load). I/O-bound jobs at 0% CPU with no output would be flagged — but a job has no
|
|
42
|
+
legitimate long idle-wait state (it runs to completion), so flagging it for attention
|
|
43
|
+
(not killing) is correct.
|
|
44
|
+
|
|
45
|
+
## 3. Level-of-abstraction fit
|
|
46
|
+
|
|
47
|
+
Correct layer. This is a cheap, deterministic process-metric read feeding an existing
|
|
48
|
+
attention-raising backstop. It reuses `hasActiveProcesses`'s exact descendant
|
|
49
|
+
tree-walk + baseline filter, adding only the CPU-time accumulation. No LLM needed —
|
|
50
|
+
the signal is objective (CPU seconds), and the escalation it feeds is attention-only.
|
|
51
|
+
|
|
52
|
+
## 4. Signal vs authority compliance
|
|
53
|
+
|
|
54
|
+
**Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
|
|
55
|
+
|
|
56
|
+
- [x] No — this change has no message block/allow surface.
|
|
57
|
+
|
|
58
|
+
It refines a SIGNAL (forward-progress) consumed by an existing smart-ish gate
|
|
59
|
+
(the backstop's episode state machine), which only ever raises an attention item and
|
|
60
|
+
never kills. No new authority.
|
|
61
|
+
|
|
62
|
+
## 5. Interactions
|
|
63
|
+
|
|
64
|
+
- **Shadowing:** The change is inside `hasForwardProgress`, one branch (ii). Branches
|
|
65
|
+
(i) transcript-growth and (iii) idle-token-change are unchanged and still short-
|
|
66
|
+
circuit to "progress" first, so a job that IS producing output/transcript is still
|
|
67
|
+
exempt before the CPU test is consulted.
|
|
68
|
+
- **Double-fire:** None — same single escalation path, same per-episode dedup
|
|
69
|
+
(`episodeActive`), so a persistently-wedged job still raises exactly one item.
|
|
70
|
+
- **Races:** `descendantCpuSeconds` is a synchronous `ps` read per snapshot, same
|
|
71
|
+
cadence/shape as the existing `hasActiveProcesses` call; no shared mutable state.
|
|
72
|
+
- **Feedback loops:** None — the output is an attention notice, which does not feed
|
|
73
|
+
back into the session.
|
|
74
|
+
|
|
75
|
+
## 6. External surfaces
|
|
76
|
+
|
|
77
|
+
- **Persistent state:** none new. ProgressSnapshot lives in memory per tick.
|
|
78
|
+
- **External systems:** none (the attention item uses the existing poster).
|
|
79
|
+
- **Other agents/users:** none — per-agent backstop.
|
|
80
|
+
- **`ps` cost:** one extra `ps -eo pid,ppid,time,command` per session per 120s tick —
|
|
81
|
+
negligible, same class as the existing `hasActiveProcesses` `ps`.
|
|
82
|
+
- **Cross-platform:** `parseProcTimeToSeconds` handles the `ps -o time` formats
|
|
83
|
+
(`MM:SS`, `MM:SS.ss`, `HH:MM:SS`, `DD-HH:MM:SS`); a bad parse reads as 0 (no growth),
|
|
84
|
+
which is safe (the delta just shows no progress; attention, never kill).
|
|
85
|
+
|
|
86
|
+
## 7. Rollback cost
|
|
87
|
+
|
|
88
|
+
Pure code change; no persistent state, no migration. Back-out is `git revert` + ship
|
|
89
|
+
the next patch — the backstop reverts to existence-based progress (the prior, looser
|
|
90
|
+
behavior). No user-visible regression during rollback (it only changes whether a
|
|
91
|
+
*job* gets a stale-attention notice). Worst case if the floor is mis-tuned: a busy
|
|
92
|
+
job flagged spuriously (attention only) or a wedged job missed — both are
|
|
93
|
+
attention-level, never destructive.
|
|
94
|
+
|
|
95
|
+
## Conclusion
|
|
96
|
+
|
|
97
|
+
The review's central risk — falsely flagging legitimately-idle sessions — is closed
|
|
98
|
+
by scoping the cpu-delta requirement to job sessions (no legitimate-idle state) and
|
|
99
|
+
leaving conversational sessions on the existing existence check. That scoping is the
|
|
100
|
+
load-bearing design decision and is directly tested. The escalation remains
|
|
101
|
+
attention-only (never a kill), and the change reuses the existing process-walk. Clear
|
|
102
|
+
to ship.
|
|
103
|
+
|
|
104
|
+
## Second-pass review (if required)
|
|
105
|
+
|
|
106
|
+
**Reviewer:** Echo (self) — Tier-1.
|
|
107
|
+
**Independent read of the artifact: concur**
|
|
108
|
+
|
|
109
|
+
The job-scoping is the right way to avoid the idle-with-bg false-positive; the three
|
|
110
|
+
behavior tests pin both the fix and the no-regression case; rollback is a revert.
|
|
111
|
+
No concerns.
|
|
112
|
+
|
|
113
|
+
## Evidence pointers
|
|
114
|
+
|
|
115
|
+
- `tests/unit/stale-session-backstop.test.ts` (13: incl. the 3 new behavior cases),
|
|
116
|
+
`tests/unit/parseProcTimeToSeconds.test.ts` (6). `tsc` + `pnpm build` clean.
|
|
117
|
+
- Root-cause + design trail: `.instar/autonomous/13435.local.md` item 2 (the iterative
|
|
118
|
+
diagnosis that caught the idle-with-bg / extended-think regression traps).
|