instar 1.3.305 → 1.3.307

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 (53) hide show
  1. package/dist/commands/init.d.ts.map +1 -1
  2. package/dist/commands/init.js +32 -30
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/core/Config.d.ts.map +1 -1
  5. package/dist/core/Config.js +2 -0
  6. package/dist/core/Config.js.map +1 -1
  7. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  8. package/dist/core/PostUpdateMigrator.js +6 -1
  9. package/dist/core/PostUpdateMigrator.js.map +1 -1
  10. package/dist/core/SessionManager.d.ts.map +1 -1
  11. package/dist/core/SessionManager.js +3 -0
  12. package/dist/core/SessionManager.js.map +1 -1
  13. package/dist/core/types.d.ts +4 -0
  14. package/dist/core/types.d.ts.map +1 -1
  15. package/dist/core/types.js.map +1 -1
  16. package/dist/scheduler/JobScheduler.d.ts.map +1 -1
  17. package/dist/scheduler/JobScheduler.js +10 -6
  18. package/dist/scheduler/JobScheduler.js.map +1 -1
  19. package/package.json +1 -1
  20. package/scripts/instar-dev-precommit.js +48 -16
  21. package/src/data/builtin-manifest.json +58 -58
  22. package/src/scaffold/templates/jobs/instar/commitment-detection.md +2 -1
  23. package/src/scaffold/templates/jobs/instar/correction-analyzer.md +5 -1
  24. package/src/scaffold/templates/jobs/instar/evolution-overdue-check.md +1 -1
  25. package/src/scaffold/templates/jobs/instar/evolution-proposal-evaluate.md +1 -1
  26. package/src/scaffold/templates/jobs/instar/evolution-proposal-implement.md +1 -1
  27. package/src/scaffold/templates/jobs/instar/failure-analyzer.md +5 -1
  28. package/src/scaffold/templates/jobs/instar/identity-review.md +5 -4
  29. package/src/scaffold/templates/jobs/instar/initiative-digest-review.md +3 -1
  30. package/src/scaffold/templates/jobs/instar/insight-harvest.md +1 -1
  31. package/src/scaffold/templates/jobs/instar/mentor-onboarding.md +7 -4
  32. package/src/scaffold/templates/jobs/instar/org-intent-drift-audit.md +6 -4
  33. package/src/scaffold/templates/jobs/instar/overseer-development.md +4 -1
  34. package/src/scaffold/templates/jobs/instar/overseer-guardian.md +4 -1
  35. package/src/scaffold/templates/jobs/instar/overseer-infrastructure.md +4 -1
  36. package/src/scaffold/templates/jobs/instar/overseer-learning.md +4 -1
  37. package/src/scaffold/templates/jobs/instar/overseer-maintenance.md +4 -1
  38. package/src/scaffold/templates/jobs/instar/release-readiness-check.md +2 -1
  39. package/src/templates/hooks/compaction-recovery.sh +11 -6
  40. package/src/templates/hooks/session-start.sh +11 -3
  41. package/src/templates/hooks/slack-channel-context.sh +5 -0
  42. package/src/templates/hooks/telegram-topic-context.sh +6 -0
  43. package/src/templates/scripts/emit-session-clock.sh +3 -3
  44. package/src/templates/scripts/imessage-reply.sh +10 -0
  45. package/src/templates/scripts/instar-watchdog.sh +12 -6
  46. package/src/templates/scripts/secret-drop-retrieve.mjs +10 -2
  47. package/src/templates/scripts/slack-reply.sh +5 -0
  48. package/src/templates/scripts/whatsapp-reply.sh +5 -0
  49. package/upgrades/1.3.306.md +22 -0
  50. package/upgrades/1.3.307.md +20 -0
  51. package/upgrades/gate-blocked-audit-hygiene.eli16.md +11 -0
  52. package/upgrades/side-effects/gate-blocked-audit-hygiene.md +41 -0
  53. package/upgrades/side-effects/template-agent-id-header.md +48 -0
@@ -0,0 +1,41 @@
1
+ # Side-Effects Review — Gate decision-audit verdict finalization
2
+
3
+ **Version / slug:** `gate-blocked-audit-hygiene`
4
+ **Date:** `2026-06-05`
5
+ **Author:** `instar-echo`
6
+
7
+ ## Summary
8
+
9
+ `writeDecisionAudit` writes entries with `verdict: 'pending'` and records `{entryPath, entryData}` in a module variable; a `process.on('exit')` hook (registered next to the variable, ABOVE the gate's top-level flow) rewrites the entry with `verdict: code === 0 ? 'pass' : 'blocked'` and re-stages it. Entry naming, staging, timing, and the riding-the-retry property are unchanged.
10
+
11
+ ## Decision-point inventory
12
+
13
+ - Entry schema — extended — new `verdict` field ('pending' at write; finalized at exit). Additive: old entries without the field remain valid; no reader migration (the decision-audit-presence CI check matches by path, not schema — verified, its 9 tests untouched and green).
14
+ - Exit hook — added — one hook covers every exit path (enforceTier1's exit(0), Tier-2 fall-through, every blockCommit's exit(1)); synchronous-only work; its own try/catch leaves 'pending' on failure (still more truthful than no verdict).
15
+ - Source-order placement — the variable AND the hook registration live above the top-level audit call site. Both failure modes fired in development: a below-call-site declaration TDZ-throws inside writeDecisionAudit's try/catch (silently skipping tracking), and a below-flow registration is never reached when blockCommit exits early (verdict stayed 'pending' — caught by the new blocked-path test).
16
+
17
+ ## Direction of failure
18
+
19
+ - Old failure: rode-along entries from blocked runs (often under 'unknown'/foreign slugs) read as real shipped decisions — twice in one day (echo #836, codey #842).
20
+ - New behavior: every entry self-describes its outcome.
21
+ - Conservative direction: a finalization failure leaves 'pending' — ambiguous but honest; never a wrong verdict.
22
+
23
+ ## Side-effects checklist
24
+
25
+ 1. **Over-block:** none — the gate's pass/block decisions are untouched; this only records them.
26
+ 2. **Exit-hook safety:** synchronous fs/execSync only (required in 'exit' handlers); wrapped in try/catch; cannot change the exit code (the 'exit' event can't).
27
+ 3. **Double-stage:** the entry is git-added at write AND at finalize — idempotent (same path, updated content).
28
+ 4. **CI interplay:** decision-audit-presence-check matches entries by PATH under .instar/instar-dev-decisions/ — schema-agnostic; its tests run green against the new field.
29
+ 5. **Level-of-abstraction fit:** the verdict is determined by the process outcome, not by threading state through every blockCommit call site — one mechanism, all paths.
30
+ 6. **External surfaces:** none — local gate script + committed JSON records.
31
+ 7. **Rollback cost:** revert; entries return to verdict-less (old shape), already-committed verdict entries remain valid.
32
+
33
+ ## Scope not taken
34
+
35
+ - No slug-resolution improvement for blocked runs (the verdict defuses the mislabeling harm; resolving the "right" slug for an unmatched trace is guesswork).
36
+ - No retroactive verdict backfill of historical entries.
37
+ - No blocked-entry relocation/exclusion — riding-the-retry stays (deliberate #827-era design: every evaluation leaves a committed trace).
38
+
39
+ ## Rollback
40
+
41
+ Revert the commit.
@@ -0,0 +1,48 @@
1
+ # Side-Effects Review — Template Agent-ID Header
2
+
3
+ **Version / slug:** `template-agent-id-header`
4
+ **Date:** `2026-06-05`
5
+ **Author:** `instar-codey`
6
+ **Second-pass reviewer:** `not required`
7
+
8
+ ## Summary of the change
9
+
10
+ This change updates the fleet-installed local API client surface so bearer-authenticated template calls also send `X-Instar-AgentId`. It adds `INSTAR_AGENT_ID` env propagation from `Config` -> `JobScheduler` and `SessionManager`, updates built-in job templates, hook/script templates, and selected migrator inline hook content, and adds a template scanner regression test.
11
+
12
+ ## Decision-point inventory
13
+
14
+ No new decision point is added. Existing server auth remains the authority for missing/mismatched agent-id headers. This change only updates clients/templates to provide identity to that existing authority.
15
+
16
+ ## 1. Over-block
17
+
18
+ No block/allow surface is added. A malformed or missing `projectName` could make a template send an empty or wrong `X-Instar-AgentId`, which the existing server auth would reject. The normal paths use `config.projectName`, and direct-run fallbacks read the same field.
19
+
20
+ ## 2. Under-block
21
+
22
+ This does not remove the server's bearer-only compatibility window. A custom user-authored curl outside shipped templates can still be bearer-only and receive the deprecation warning until the server policy changes.
23
+
24
+ ## 3. Level-of-abstraction fit
25
+
26
+ The fix sits at the client/template layer. The server already owns auth authority and should not be weakened to hide template warnings. Scheduler/session env propagation is the right shared primitive for jobs and hooks.
27
+
28
+ ## 4. Signal vs authority compliance
29
+
30
+ Required reference: `docs/signal-vs-authority.md`
31
+
32
+ No brittle blocking authority is introduced. The change feeds identity into the existing deterministic auth authority; it does not add a new detector or gate.
33
+
34
+ ## 5. Interactions
35
+
36
+ The scheduler now injects `INSTAR_AGENT_ID` alongside `INSTAR_AUTH_TOKEN` for gate and script job shells. `SessionManager` injects the same variable for spawned sessions, so hook and prompt-job examples have it. Fleet watchdog peer requests read the peer project name and bind the peer token to the peer identity.
37
+
38
+ ## 6. External surfaces
39
+
40
+ Installed agents get quieter logs and future-compatible local API calls after template refresh/migration. No public API response shapes change. No persistent state is written.
41
+
42
+ ## 7. Rollback cost
43
+
44
+ Rollback is a source/template revert and patch release. Existing agents would fall back to the current accepted-but-deprecated bearer-only behavior until a corrected template ships.
45
+
46
+ ## Conclusion
47
+
48
+ Clear to ship as Tier 1. The change aligns installed templates with the existing auth contract and pins the class with a scanner test.