instar 1.3.1981 → 1.3.1983

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.
Files changed (32) hide show
  1. package/dashboard/console/console.css +7 -0
  2. package/dashboard/console/needs-strip.js +22 -5
  3. package/dashboard/console/plans-model.js +3 -0
  4. package/dist/commands/init.d.ts +1 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +29 -3
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  9. package/dist/core/PostUpdateMigrator.js +28 -2
  10. package/dist/core/PostUpdateMigrator.js.map +1 -1
  11. package/dist/data/standards-guard-index.json +1 -1
  12. package/dist/data/standards-guard-index.meta.json +2 -2
  13. package/dist/data/standards-registry.meta.json +1 -1
  14. package/dist/monitoring/NativeHookEvents.d.ts +10 -0
  15. package/dist/monitoring/NativeHookEvents.d.ts.map +1 -1
  16. package/dist/monitoring/NativeHookEvents.js +37 -0
  17. package/dist/monitoring/NativeHookEvents.js.map +1 -1
  18. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  19. package/dist/native/instar-desktop-host +0 -0
  20. package/dist/server/routes.d.ts.map +1 -1
  21. package/dist/server/routes.js +4 -1
  22. package/dist/server/routes.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/data/builtin-manifest.json +64 -64
  25. package/src/data/standards-guard-index.json +1 -1
  26. package/src/data/standards-guard-index.meta.json +2 -2
  27. package/src/data/standards-registry.meta.json +1 -1
  28. package/upgrades/1.3.1982.md +26 -0
  29. package/upgrades/1.3.1983.md +16 -0
  30. package/upgrades/side-effects/hook-reporter-event-delivery.md +139 -0
  31. package/upgrades/side-effects/needs-you-clear-groups.md +44 -0
  32. package/upgrades/side-effects/usage-pool-roots-fixture.md +70 -0
@@ -0,0 +1,139 @@
1
+ # Side-Effects Review — Hook reporter event delivery (real event names and the session id)
2
+
3
+ **Version / slug:** `hook-reporter-event-delivery`
4
+ **Date:** `2026-11-21`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `codex-cli:gpt-6.2-astra (independent, see the section at the end)`
7
+
8
+ ## Summary of the change
9
+
10
+ The built-in command hook reporter read the event name from `hook_event` (Claude Code sends `hook_event_name`) and never
11
+ put the instar session id in the payload, so every Stop, SubagentStart, SubagentStop, TaskCompleted, SessionEnd and
12
+ PreCompact event was stored as `Unknown` and their consumers never ran on the default path. Both copies of the script
13
+ (update path in `PostUpdateMigrator.ts`, new agents in `init.ts`) now read `hook_event_name` first, validate the session
14
+ id once (an invalid id sends nothing), add `instar_session_id` and `instar_session`, and forward six short identifying
15
+ fields bounded in the script. No message text is sent. The `/hooks/events` route applies the native path's bounds to
16
+ those fields with `boundCommandReporterPayload` (new, `NativeHookEvents.ts`) and uses one validated session id for both
17
+ storage and the dispatcher. Spec: `docs/specs/hook-reporter-event-delivery.md`.
18
+
19
+ ## Decision-point inventory
20
+
21
+ - Which events a consumer receives — invariant (Claude Code's own field).
22
+ - Field bounds on the command path — invariant (native bounds reused for the listed fields).
23
+ - Session id sent by the script — invariant (matches the id pattern or is sent nowhere).
24
+
25
+ ## 1. Over-block
26
+
27
+ An agent whose `INSTAR_SESSION_ID` does not match `^[A-Za-z0-9._:-]{1,128}$` now sends no hook events at all (before:
28
+ events were sent with that id). Instar mints ids that match (UUIDs and tmux-safe names), so no real agent is expected to
29
+ hit this; such an id could not be attributed by the route anyway. Fields failing their bound are dropped from the
30
+ payload while the event still arrives: a malformed `agent_id` or `task_id`, an `agent_type` or `instar_session` over
31
+ 128 characters, a relative or over-1024-character `agent_transcript_path`, a `reason` or `trigger` over 64. The route
32
+ now overwrites a caller-supplied `instar_session_id` with its own validated value, or removes it. Consequence for a direct caller that
33
+ supplies the id only in the body (no scoped session and no valid `instar_sid` query): the event is still stored, but
34
+ without a session id, so consumers that require one (Compaction Trigger 1, the practice-fold trigger) do not act on
35
+ it. This is deliberate (the route speaks only for the session it can attribute); the built-in scripts always send the
36
+ query value. No other caller of this route is known in the source tree.
37
+
38
+ ## 2. Under-block
39
+
40
+ Codex bodies without `hook_event_name` and without `tool_name` still arrive as `Unknown` (unchanged). The session
41
+ summary's last-message field and the HelperWatchdog's failure markers from a subagent's final text are not fed by the
42
+ built-in command scripts (they send no message text); they are fed by the native reporter, or by a direct caller of
43
+ `/hooks/events` that posts the text (redacted and cut to its last 200 characters by the route). The practice-fold runner still
44
+ cannot read a handoff reply from the hook; that is a separate spec, and practice folds stay off on Echo until it ships.
45
+
46
+ ## 3. Level-of-abstraction fit
47
+
48
+ Right layer: the defect is in the reporter that every agent runs; the server-side bounds sit beside the native
49
+ projection they mirror. The native reporter (docs/specs/native-hook-events.md) is the long-term path and is unchanged.
50
+
51
+ ## 4. Signal vs authority compliance
52
+
53
+ No authority added. The reporter and route carry events; they decide nothing. They do become new inputs to existing
54
+ consumers that act, exactly as the native path already feeds them: the compaction sentinel (can inject recovery input
55
+ into the compacting session), the pre-compaction flush where enabled (writes durable facts), and the HelperWatchdog
56
+ (alerts behind their own default-off gate). Those consumers' own gates and scopes are unchanged.
57
+
58
+ ## 4b. Judgment-point check
59
+
60
+ No competing-signals decision point is touched; no static heuristic is added.
61
+
62
+ ## 5. Interactions
63
+
64
+ Consumers that start receiving events on the command path, as they already do on the native path: `SubagentTracker`
65
+ (start/stop/session end), Compaction Trigger 1 (scoped to the emitting session; Triggers 2 and 3 already cover
66
+ compaction, and the sentinel dedupes across triggers), the per-instar-session index in `HookEventReceiver` (now
67
+ includes command-path rows), the practice-fold runner's Stop trigger (dev-gated; off on Echo; off on the fleet), and the pre-compaction memory flush
68
+ (`wirePreCompactionFlush`, `PreCompact`): off by default (`preCompactionFlush.enabled`), but ON on Echo, where it has
69
+ been blind on the command path. Where it is on, each delivered `PreCompact` now reaches its flush, which (given an intelligence provider, a
70
+ session id and a readable, non-empty transcript) makes one bounded model call over the transcript
71
+ (`transcriptCharBudget`) and writes at most `maxFactsPerFlush` durable facts when extraction yields any; every delivered `PreCompact` also
72
+ writes an audit entry (including when the flush skips, finds no facts, or the provider errors). Compaction
73
+ Trigger 1 feeds the compaction sentinel, which can inject recovery input into the compacting session (scoped to that
74
+ session; the sentinel already dedupes across its three triggers). Subagent events start the HelperWatchdog's stall
75
+ tracking and logging; its injected alerts stay behind their own default-off gate.
76
+ Codex: `PostToolUse` rows already carried `tool_name` (981 of 981 sampled), so their naming is unchanged; what changes
77
+ is that the dispatcher receives the validated id and the stored row gains session attribution, so per-session
78
+ summaries count these rows;
79
+ its `UserPromptSubmit` rows are named only where Codex sends `hook_event_name` (the test supplies the field; on Echo
80
+ 32 Codex prompt rows were stored named after the local patch, evidence that it does), and no consumer listens for that
81
+ name. The existing wiring test pinning that
82
+ both routes call the shared dispatch function was updated for the validated id variable.
83
+
84
+ ## 6. External surfaces
85
+
86
+ Observable effects beyond storage, where the consuming feature is on: recovery input injected into a compacting
87
+ session, durable memory facts from the pre-compaction flush, and HelperWatchdog alerts (default off). The scripts post
88
+ to `INSTAR_SERVER_URL`, unchanged.
89
+
90
+
91
+ Stored hook-event rows gain names and fields; dashboard session telemetry (`GET /sessions`, summaries) can now show
92
+ command-path subagent and task data. Where the pre-compaction flush is on, durable memory facts are written at
93
+ compaction (bounded, audited). No messages to users, no new routes, no new config. New for direct callers of
94
+ `/hooks/events`: `last_assistant_message` and `task_subject` are now redacted and cut to their last 200 characters
95
+ before storage and dispatch (before this change a direct caller's text was stored as received); the built-in scripts
96
+ send none. Unchanged: a scoped caller's `transcript_path`, `agent_transcript_path` and `cwd` are removed before
97
+ dispatch, so consumers receive no paths from scoped requests.
98
+
99
+ ## 7. Multi-machine posture (Cross-Machine Coherence)
100
+
101
+ Machine-local by design (unchanged): a hook fired by a Claude Code process is delivered over loopback to the server on
102
+ the same host and stored in that machine's `hook-events/`. No user-facing notices, no durable state that moves with a
103
+ topic, no generated URLs. Status surfaces: none new or changed.
104
+
105
+ ## 8. Rollback cost
106
+
107
+ Pure code change. Revert and ship a patch; built-in hooks are overwritten on the next update, so agents return to the
108
+ old script automatically. Stored rows written meanwhile stay valid (extra fields are ignored by older readers). Effects
109
+ of consumers that ran meanwhile are not undone by a revert: durable facts written by an enabled pre-compaction flush stay
110
+ in memory (they are ordinary, audited, removable memory entries), and recovery input already injected stays in those
111
+ sessions' history, as do any HelperWatchdog alerts injected where that gate is on.
112
+
113
+ ## Conclusion
114
+
115
+ Ship. The change restores events that existing consumers were designed for, sends no message text, and is covered by
116
+ an integration test that runs both real script copies against the real server (fails on the old code), plus unit tests:
117
+ `tests/integration/command-hook-reporter.test.ts` (10 tests), `tests/unit/command-hook-reporter-fields.test.ts` (5),
118
+ and the updated wiring assertion in `tests/unit/native-hook-events-consumers.test.ts`. Limits: the init copy is
119
+ compared with the update copy at the wire (byte-identical) rather than also sent through the server, and the
120
+ consumers' own effects (recovery injection, flush writes) are covered by their existing native-path tests, not
121
+ re-exercised end to end here.
122
+
123
+ ## Second-pass review (independent, codex-cli:gpt-6.2-astra, 2026-11-22)
124
+
125
+ Concur with the review.
126
+
127
+ "Both reporters restore event names and attach the instar session ID without forwarding message text. The route uses
128
+ its validated session ID for storage and dispatch, and bounds the new fields before either. The artifact accounts for
129
+ the restored consumer effects, their existing gates, and the changes for direct callers."
130
+
131
+ Earlier runs of the same reviewer raised concerns, each corrected in this artifact before the concurring run: the
132
+ pre-compaction flush consumer and its durable writes and audit entries; recovery injection and watchdog effects that a
133
+ revert cannot undo; direct-caller text redaction being new; scoped callers losing paths; body-only session ids being
134
+ dropped; and a spurious "deleted test suite" that came from comparing against a newer main (the branch was then
135
+ fast-forwarded and the diff taken against the merge base).
136
+
137
+ ## Full-gate metadata correction — 2026-11-22
138
+
139
+ The retained full-gate failure at `000b49408029` was the ladder registry assertion: this spec used `none` for a flagless defect fix, while the established contract requires `not applicable:` followed by a reason. The spec now uses that contract and preserves the rollout sequence. No registry entry is invented and no assertion or runtime behavior changes. This follow-up is Tier 1, two documentation files and no runtime edits. Full-gate requalification remains required.
@@ -0,0 +1,44 @@
1
+ # Side-Effects Review — Clear Needs You Groups
2
+
3
+ Date: 2026-11-22. Author: echo. Tier 1, reversible display repair.
4
+
5
+ ## Summary
6
+ Group the expanded Needs-you list by structured source/severity, bound its height and preserve keyboard position. A tracking-only project with autoAdvance:false and no scheduled launch does not create a first-launch ask. Unacknowledged advances, scheduled launches and explicit owner asks remain. No state mutation. One review round found incorrect group wording and keyboard focus/refresh issues; these were corrected and re-reviewed.
7
+
8
+ ## Decision-point inventory
9
+ The projectNeedsOk display predicate consumes explicit project settings and scheduled-launch state. No approval authority changes. needGroups only labels received rows; it neither filters nor deduplicates them.
10
+
11
+ ## 1. Over-block
12
+ No action block/allow surface. Tracking projects with a scheduled launch remain visible. An unknown autoAdvance setting retains existing conservative behavior. Explicit needsUser and awaiting-user asks still appear.
13
+
14
+ ## 2. Under-block
15
+ No action block/allow surface. A tracking record may still contain an explicit stale ask; resolving its authority is outside this presentation logic and remains visible.
16
+
17
+ ## 3. Level-of-abstraction fit
18
+ Pure console models are already loaded by the Needs route. Display grouping lives in the strip, not source permissions. No second inbox or count is introduced.
19
+
20
+ ## 4. Signal vs authority compliance
21
+ Reference: docs/signal-vs-authority.md. This is a read-only signal display. ProjectRoundRunner retains first-launch and advancement authority. No text heuristics judge whether an ask is legitimate.
22
+
23
+ ## 4b. Judgment-point check
24
+ No new static heuristic at a competing-signals decision point. An explicitly unscheduled tracking project has no requested first launch; the enumerable display condition does not authorize one.
25
+
26
+ ## 5. Interactions
27
+ All received actions, card links, page cursors and incomplete-read notices remain. Successful polling preserves a focused action or scroll region; access denial still clears it. Unknown sources receive Other requests.
28
+
29
+ ## 6. External surfaces
30
+ The expanded web dashboard list changes visually. The shared /needs model no longer counts unscheduled tracking launches as owner tasks, so other clients receive the corrected count too. No API schema changes.
31
+
32
+ ## 6b. Operator-surface quality
33
+ Compact line stays the entry point. The expanded list has descriptive headings and bounded scrolling. Work-board rows say Work that needs you, covering approvals, questions and completion checks. No technical identifiers added.
34
+
35
+ ## 7. Multi-machine posture
36
+ Presentation ships in dashboard assets. Needs routes load the same console model per agent server; source replication and pool reads are unchanged. No machine-local state or links are added.
37
+
38
+ ## 8. Rollback cost
39
+ Revert the code and redeploy normally. No migration, source-state edits or approval repair is required.
40
+
41
+ ## Validation and review
42
+ 68 focused tests passed across console-plans, console-needs-pages and needs-read. Includes a real server composer test with tracking, scheduled and explicit owner requests, mixed-source grouping, paging, denied reads and scroll-position preservation. Three independent reviewers checked correctness, gaps and missing tests. Correctness and accessibility reviewers re-read corrections and concurred. Complete verification will run through the throughput coordinator; targeted checks are not a full-green claim. Browser previews use captured live /needs data and current source assets, not a released deployment.
43
+
44
+ Browser review: previews at 1440×1000 and 390×844 use captured live data and current assets. The count appeared twice in the expanded heading, so the earlier saved wording repair is included here: the badge alone carries the count. Pre-push rejected a malformed release fragment before sending; corrected by adding its required section heading. No gate was waived.
@@ -0,0 +1,70 @@
1
+ # Side-Effects Review — Order the usage-ledger fixture before its event
2
+
3
+ **Version / slug:** `usage-pool-roots-fixture`
4
+ **Date:** 2026-11-22
5
+ **Author:** echo
6
+ **Second-pass reviewer:** reset_spec_integration (independent small-change review)
7
+
8
+ ## Summary of the change
9
+
10
+ Tier 1, small and reversible. One unit-test fixture changes; its plain-language overview and this required review accompany it. The test creates both original files before choosing their event timestamp and then writes their observations. The previous thirty-millisecond guess could expire before the Claude file was created under load. Production code, all assertions and the real backup-age wait remain unchanged. One review pass; commit/gate attempts are recorded in the work evidence.
11
+
12
+ ## Decision-point inventory
13
+
14
+ Only fixture construction order changes. There is no production decision point, account routing, credential mutation or new authority.
15
+
16
+ ## 1. Over-block
17
+
18
+ No runtime block/allow surface. A real failure to count an original or deduplicate copied history still fails the same assertions.
19
+
20
+ ## 2. Under-block
21
+
22
+ No runtime safeguard is loosened. The fixture does not simulate every filesystem clock anomaly; its event is explicitly at or after both recorded original birth times.
23
+
24
+ ## 3. Level-of-abstraction fit
25
+
26
+ The incorrect assumption is in test setup. The production ledger's original-versus-copy classification is left intact.
27
+
28
+ ## 4. Signal vs authority compliance
29
+
30
+ Required reference: [Signal vs Authority](../../docs/signal-vs-authority.md). There is no runtime authority change. The test continues to surface a failure signal to normal verification.
31
+
32
+ ## 4b. Judgment-point check
33
+
34
+ No new static heuristic at a competing-signals decision point. The fixture establishes a causal ordering rather than choosing a timeout to stand in for it.
35
+
36
+ ## 5. Interactions
37
+
38
+ Both original files retain their birth times when rewritten. The later backup creation still occurs after the existing 1130 ms wait, preserving Codex's one-second copied-history tolerance. Both backup-first and original-first scan orders remain tested, as does repeat-scan idempotency.
39
+
40
+ ## 6. External surfaces
41
+
42
+ No user-facing or external runtime surface changes. No account, model, configuration or saved transcript is touched outside temporary test fixtures.
43
+
44
+ ## 6b. Operator-surface quality
45
+
46
+ No operator surface changes. The accompanying overview explains the test repair in ordinary language.
47
+
48
+ ## 7. Multi-machine posture
49
+
50
+ The test fix is replicated through source control and runs on every verification machine. Fixture files are machine-local because filesystem birth times are physical local observations; they never enter agent synchronization.
51
+ machine-local-justification: hardware-bound-resource
52
+
53
+ ## 8. Rollback cost
54
+
55
+ Revert the test commit. No data migration, credential restoration or account change is needed.
56
+
57
+ ## Evidence pointers
58
+
59
+ - Retained Windows full-run evidence: `.instar/recovery/retention1961/pr3625-manual-full-suite.log` on the Studio. This is separate from main's failed-file-only record; no missing main assertion is fabricated.
60
+ - Controlled old-fixture delay: `.instar/recovery/token-reset-routing/usage-pool-roots-delay-red.log` on the Studio. A 60 ms delay reproduced calls 1, input 123 and output 7 instead of calls 2, input 132 and output 10.
61
+ - Corrected fixture and identical delayed diagnostic: `.instar/recovery/token-reset-routing/usage-pool-roots-delay-green.log` on the Studio. The diagnostic file is temporary and is not part of this pull request.
62
+ - Independent small-change review concurred: no material findings; all assertions and production logic remain intact.
63
+ - Full verification remains the normal shared Local Verify gate; targeted evidence is not claimed as a complete suite pass or a deployment.
64
+
65
+
66
+ ## Current-main verification repair (2026-11-22)
67
+
68
+ The original exact7fb451e6d7fb63ad216d827d93c5acbab658f510 complete gate failed in console-chats-page.test.ts, not in this ledger file. The coordinator retained the failed filename/count but its original assertion artifact is absent; neither this artifact nor source comparison reconstructs that historical assertion or proves its cause.
69
+
70
+ This merge brings the unchanged ledger fixture repair onto mainbc7d28135a7d298b68526d70a49a19856e9cc73e. The index retains main's console fixture byte-for-byte at blob473d0d1ed9c91a249c01cea530f84130927426f5 (the shared3655 lifecycle correction). No console assertions, native Web Locks or timeouts are edited by this repair. Independent base-alignment review concurred with no material findings. One new Node22 focused run of ledger8 plus console29 checks passed37/37; this is new supporting evidence, not a recovered historical assertion or full-gate clearance. A new normal complete gate on the corrected exact head is required before merge. Retained proof: .instar/recovery/token-reset-routing/usage-repair-current-main-focused.log.