Skip to content

feat: one hook process, leaner rules, companion hardening (0.0.65) - #77

Merged
okisdev merged 24 commits into
mainfrom
feat/0.0.65-audit-optimizations
Oct 15, 2026
Merged

okisdev merged 24 commits into
mainfrom
feat/0.0.65-audit-optimizations

Conversation

@okisdev

@okisdev okisdev commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

summary

  • this release acts on an audit of the codebase and of local run history (2,812 codex, 952 grok, and 12 cursor jobs, 1,079 claude worker records, 33,649 inline guard events, 12,526 claude code transcripts). the always loaded orchestration.md drops from 76.8 kb to 43.9 kb: engine internals, the full routing notes, and lifecycle detail move verbatim into an orchestration reference section of troubleshooting.md, the remaining core is condensed without dropping a rule, the rendered routing table drops its notes column, and four contradictions are resolved; the five transport agents set omitClaudeMd: true and effort: low
  • fusion hooks: inline guard advisories now reach the model as additionalContext (2,058 of them never had) and no longer auto-approve the write they annotate; fusion-hook.mjs runs the lifecycle and guard handlers in one process (a PreToolUse Edit measured 36 ms against 64 ms); worker budgets follow observed p95 usage and record a limitKind; the stop gate releases after three identical blocks; the retention sweep runs every six hours and keeps monthly rollups
  • codex: one deadline from ingress for tasks and reviews, the timer stops when the child closes, wind-down --job <id> replaces the resume command the wrapper used to copy out of output, records and briefs keep 5,000 jobs or 90 days while heavy artifacts keep the old caps, writes are batched, and a process group that outlives its dead leader stops blocking the workspace after ten minutes. grok: a quota failure with payment evidence opens a one hour cooldown, footers follow the contract, capability probes are cached, one deadline covers preflight through cleanup, and the sandbox handshake reads incrementally. cursor: a finished run's private home shrinks to its resume chat (56 kb instead of about 6.4 mb) with a shared npm cache, and failure classification keeps quota and rate limits pool scoped
  • no backward compatibility is kept for data or invocations from older releases: job records must carry the current schema or take the unreadable path, so read-time defaults, aliases, and migrations are gone (codex sessionId alias, grok's legacy process state, the codex monitor's terminal ledger migration, the plain directory lock reclaim for companions older than 0.0.23, the retired guard allow subcommand, the acceptance epoch and its pre-tracking cohort)
  • no function is nested inside another for shared state: shared/companion/ is the single source for process identity, argument parsing, the record lock, and the raw-args transport, now module level functions configured once per companion instead of closure factories; the codex, grok, and cursor run supervisors keep their run state in one context object passed to module level functions; pass-through wrappers are inlined. fusion-stats, worker-lifecycle, the inline guard, codex runCodex, and grok-companion are split behind their existing entry points and exports
  • a pre-merge review wave (codex, grok, cursor, and a deep reasoner, one scoped brief per subsystem) found and this branch fixes: grok and cursor group probes that disagreed with the shared zombie-aware identity (cancel reported incomplete cleanup on linux), a codex timer that could wait forever on output held by an escaped helper, the ten minute slot release firing for a live leader without an identity, reviews missing the ingress deadline, a bare quota word opening the grok cooldown, a missing grok binary classified as setup, a refresh backoff that never started when the refresh exhausted the deadline, a dropped modelDrift on cursor cancel, and monitor caches that could miss a same size rewrite

test plan

already verified

  • npm test -> 1619 tests, 1616 pass, 0 fail, 3 skipped (linux only); the same suite on main was 1438 tests with 5 failing (four jev calibration tests that read the host's ledgers, one load flake)
  • the full suite in a node:22 linux container: everything passes except 11 tests that need git 2.42 worktree add --orphan or a repository whose .git resolves inside the container; the grok cancel suite also passes with a non reaping pid 1, where it failed before the group probe fix
  • every new regression test fails on the unfixed source and passes on the fix (codex deadline, held output, live leader slot, grok zombie consumer state)
  • claude plugin validate on plugins/codex, plugins/grok, plugins/cursor, and plugins/fusion, plus claude plugin validate . --strict -> all passed; node bench/manifest.mjs --check and node shared/sync.mjs --check -> clean
  • live probes through the repo companions with isolated data roots: codex-cli 0.162.1 luna task -> done with OK; grok 1.0.52 consult twice -> done, the footer carries delivery and semantic, and capabilities.json is cached; cursor composer-2.5 consult -> done, the language server landed in the shared npm cache, and the finished run home pruned to 56 kb
  • fusion-stats.mjs --all on the real ledgers renders the compact report, and tests/fusion-stats-modules.test.mjs checks the split renderer byte for byte

reviewer should verify

  • after claude plugin marketplace update claude-code-fusion and a new session, a Read tool call still runs worker-lifecycle.mjs: hooks.json now uses negative lookahead matchers such as ^(?!(?:Edit|Write|NotebookEdit|MultiEdit|Bash|Agent|Task|SendMessage|TaskOutput|TaskStop)$).*$, which claude code documents as JavaScript regex without naming lookahead
  • a codex:codex-rescue subagent transcript in that session no longer contains # Orchestration policy (omitClaudeMd: true)
  • /fusion:smoke passes on the new version
  • jobs recorded by 0.0.64 no longer show in status, result, or history after the upgrade; that is the intended effect of dropping backward compatibility

notes

  • the grok tested interval stays [1.0.14, 1.0.42): the consult path passes on 1.0.52, but OrbStack's ~/.orbstack/run/docker.sock still makes the companion refuse grok write runs on this host, so the write path stays unverified (live pass for grok 1.0.52 and the grok burst arm of the lane snapshot #75)
  • not done on purpose: replacing the sonnet wrapper hop with a scripted transport (an architecture change; omitClaudeMd plus effort: low cover most of the measured wrapper cost) and a singleton monitor (claude code offers no shared monitor process, so each session's monitor now scans incrementally instead)
  • rules edits, per CONTRIBUTING's rules release checklist: moved text is verbatim except two sentences deleted from the reference, one saying compatibility shims expire on the retention horizon (none remain) and one documenting FUSION_ACCEPTANCE_EPOCH (removed with the epoch); rules-manifest.json is regenerated, the moved assertions in tests/rules-sync.test.mjs read troubleshooting.md, and the collector enum pin includes cursor
  • follow ups left out of this pr: the exited leader gates in grok and cursor read a zombie pid as free, so a pid reused by a stranger's zombie group leader with live children could be signalled (needs pid reuse inside the window; a start time check would close it), and the observer state keeps ids while their job files remain

grok and cursor kept raw kill(-pid, 0) group probes beside the shared zombie-aware identity, so on linux an unreaped zombie read as an unverified live group and cancel reported incomplete cleanup. every group probe in both companions now goes through the shared processGroupAlive.
reviews take the ingress deadline like tasks, the ten minute orphan release now requires a dead leader, and a child that exited while an escaped helper still holds its output is closed at the deadline and settles on its exit status. the uncooperative child timeout test gets a 3 s budget so a loaded runner can start the fake codex before the deadline.
a cancel request no longer drops modelDrift from the finished cursor record, and the codex monitor and engine observer reparse a record replaced by rename even when its size and mtime match.
the one hour cooldown now needs payment evidence instead of the bare word quota, a missing binary stays missing_cli through capability preflight, a stale token refresh that exhausts the deadline still records its attempt, and the jobs monitor keys its cache by inode.
the record lock and raw-args transport are module level functions configured once by each companion instead of closure factories, the process identity module exports its liveness check directly, and the plain directory lock reclaim for companions older than 0.0.23 is gone.
job records must carry the current schema or take the unreadable path, read-time defaults and aliases for older records are gone, the group liveness wrappers call the shared probe directly, and helpers nested in the exec, home, and model modules move to module scope.
the legacy process state folds into unverified, incomplete records take the unreadable path instead of being normalized or narrowed, stats stop reconstructing older record shapes, failure footers render the record's own delivery and semantic status, and nested helpers in grok-exec and the jobs monitor move to module scope.
the retired allow subcommand, the terminal ledger migration, old observer and worker record normalization, the pre-tracking cohort with its acceptance epoch, and the legacy async delivery inference are gone; pass-through wrappers are inlined and nested helpers in the monitors, stats, lifecycle, breaker check, and bench move to module scope.
records lose the sessionId alias and read-time defaults, retired internal option names and alias mapping are gone, the hasOwn and termination pass-throughs are inlined, and nested run output and supervisor helpers move to module scope.
runGrok, runCursor, and the codex supervisor and event parser hold their shared run state in one context object passed to module level functions instead of closures defined inside the run; the only functions left inside another are inline API callbacks and one line listener arrows kept for removal. the fleet ledger's window helpers move to module scope the same way.
the troubleshooting reference drops the sentence about compatibility shims expiring on the retention horizon, since none remain, and the FUSION_ACCEPTANCE_EPOCH knob that was removed.
parseCodexEventStream is the implementation again instead of a wrapper that rebuilt its argument for consumeCodexEventStream.
@okisdev
okisdev merged commit cc875d7 into main Oct 15, 2026
4 checks passed
@okisdev
okisdev deleted the feat/0.0.65-audit-optimizations branch October 15, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant