Skip to content

refactor: leaner rules and hooks, shared companion runtime (0.0.76) - #100

Merged
okisdev merged 7 commits into
mainfrom
refactor-fusion-core
Nov 15, 2026
Merged

okisdev merged 7 commits into
mainfrom
refactor-fusion-core

Conversation

@okisdev

@okisdev okisdev commented Nov 15, 2026

Copy link
Copy Markdown
Owner

summary

  • acts on a usage review of one host: fourteen days of transcripts, 306 main sessions, about 3,760 USD of API-equivalent main loop cost. requests above 200,000 tokens of context took 70% of it, notification started turns 30%, fusion bookkeeping about 6.6%, and the rules file about 3%.
  • correctness: a failed or empty Read or TaskOutput no longer collects a worker or applies a queued accepted verdict (a test asserted the old behaviour); settling a linked collector by engine job id matches settling it by task id; retention rollups record retired ids so a retry after a failed unlink no longer double counts; claude-worker and trivial-worker turn caps match the largest runtime budget.
  • fewer main loop turns: the stop gate prints a directly runnable node <fusion-stats.mjs> --record command with every pending id, and safe text --reason/--failure-kind forms pass directly instead of through the four call transport.
  • rules: orchestration.md goes from 48 KB to 13.7 KB. hook enforced mechanics, engine detail, clocks, and panel and fleet ceremony live in troubleshooting.md and the skills. the false claim that run_in_background: false makes a dispatch synchronous is removed (verified with and without work in flight), and the stale engine: codex|grok collector grammar is fixed.
  • removals: the strict posture (no strict session since 2026-08-02) with its write budget deny, tail allowance, and zero-dispatch relief; the unverified write advisory (96% of guard warnings, no lift over the base rate); six audit fields nothing read; four functions with no caller.
  • core: a lifecycle denial skips the guard and dispatch accounting is idempotent per tool_use_id; engine acceptance runs after the record lock is released with a 10 second timeout and monitor retries; one lib/storage.mjs owns locking and atomic writes (observer state no longer loses concurrent updates); stale session pruning runs every ten minutes instead of every call (103 locks per Read with 100 sessions on disk, now 1); SessionStart and Agent pre-dispatch run one process each; an ignored tool call loads 5 modules instead of 39.
  • companions: grok job state sits on the shared job-state factory (928 to 246 lines) and picks up the lease preflight and sweep lock; cursor and devin share one command loop and footer renderer; a timed out cursor job says so; codex vendors the shared record lock and argument parser, and every lock timeout names its holder.
  • fusion:deep-reasoner runs at high effort, and design or root-cause prompts get a one line hint to consult it.
  • where to read: plugins/fusion/scripts/lib/{storage,lifecycle/tools,lifecycle/collection,engine-acceptance,guard/state,guard/handler}.mjs, fusion-hook.mjs, shared/companion/{job-state,companion-commands,record-lock}.mjs. the plugins/*/scripts/lib copies of shared modules are shared/sync.mjs output and rules-manifest.json is generated.
  • release 0.0.76 across every plugin and the marketplace, with a changelog entry.

breaking changes

  • /fusion:config set-posture and FUSION_POSTURE are gone; an existing strict setting is ignored and behaves as the default.
  • the unverified write advisory no longer appears.

test plan

already verified

  • npm test -> 2210 tests, 2207 pass, 0 fail, 3 skipped (2141 before the change)
  • node shared/sync.mjs --check passes
  • claude plugin validate passes for codex, grok, cursor, devin, fusion, and the marketplace root
  • node plugins/fusion/scripts/generate-rules-manifest.mjs leaves the manifest current
  • two parallel subagent dispatches with run_in_background: false, and one with nothing in flight, all returned an async launch receipt

reviewer should verify

  • after refreshing the plugin cache, /fusion:smoke passes

notes

grok job state runs on the shared job-state factory, cursor and devin share one command loop and footer renderer, and codex vendors the shared record lock and argument parser. a timed out cursor job reports the timeout, and every engine's lock timeout names the holder.
fixes collection on failed reads, settlement by engine job id, and double counted retention rollups. removes the strict posture and the unverified write advisory, moves engine acceptance out of the record lock with retries, unifies locking in one storage module, takes stale session pruning off the per call path, merges hook processes, and settles from a printed direct command.
orchestration.md drops from 48 KB to 13.7 KB. hook enforced mechanics, engine detail, and clocks move to troubleshooting.md, which also stops claiming run_in_background false makes a dispatch synchronous.
a replaced verdict no longer races an older in flight delivery, an abandoned final claim stays retryable, and the stale prune boundary test uses a whole second clock so node 22 timestamp rounding cannot age the fixture.
terminal maintenance runs after the record lock is released, so removing the sandbox on the terminal record raced the worker's last writes with ENOTEMPTY.
@okisdev
okisdev merged commit e49abcc into main Nov 15, 2026
6 of 7 checks passed
@okisdev
okisdev deleted the refactor-fusion-core branch November 15, 2026 16:36
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