feat: engine registry, jev calibration, codex late close fix (0.0.59) - #63
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
engine identity ({codex, grok}: ids, display names, rescue and managed agent types, companion file and environment names, data directory names, the contract's terminal status set) moves into one registry,
plugins/fusion/scripts/lib/engines.mjs. the same facts were derived again across the fusion scripts and had started to drift: the grok data directory was resolved in two places, the terminal status set was copied five times with different members, the peer agent type sets lived in four files, andfusion-stats.mjsalone carried three engine registriestwelve fusion scripts now read the registry (
worker-lifecycle,worker-state,fusion-stats,job-collect,engine-acceptance,engine-job-state,codex-state-roots,breaker-check, both job monitors,inline-delegation-guard,brief-sensor). every message, regex match set, export and signature is unchanged for the two current engines. engine specific behavior stays put on purpose: the codex only capability branches infusion-stats, the breaker's failure patterns and legacy status tolerance, the codex ledger versus grok collector acceptance asymmetry, strict versus lenient companion overridestests/engines.test.mjspins the registry and guards it: a fusion script that repeats an engine identity literal fails the suite, andhooks.json(static JSON, so it stays literal) may only wire peer agents the registry knowsthe jev threshold gets a repeatable calibration,
bench/jev/calibrate.mjswith twelve labeled briefs: exit 1 on a missed flaw, a false positive or a call without an answer,--model <id>to score a candidate before the pin moves (soaskJevtakes{ env, model }), and an opt in--retainedreplay that is scoped to the checkout holding the script, never the caller's directoryreviewable logic is
lib/engines.mjs, the twelve consumer diffs andbench/jev/calibrate.mjs; the rest is tests, the verification manifest (now maps the registry to its consumer suites and covers five scripts that had no entry), docs and the 0.0.59 releasecodex: a cancelled or timed out run whose process tree is verifiably gone is no longer recorded as
cleanup-requiredbecause the child'scloseevent arrived late. the exec layer waited only 50ms for that event after verified termination; on a starved machine it lands later, which left finished jobsrunningand is what kepttest (macos-latest, 22)red on a rotating set of process cases (flaky: codex companion process tests fail on the macos-latest node 22 job under load #64, also red on main's own push runs). the window is 2000ms now, armed only whilecloseis pending and cleared when it arrives; the timeout path budget becomes 591075ms, still under the 600000ms Bash cap. four test races of the same family are fixed beside it (two 50ms timeouts that raced the fake CLI's startup, a 2000ms cap on a whole companion run, 100ms gaps used to order two pipes, and the fake's pipe holder sized against the old window)both job monitors install their signal and EPIPE handlers before the first scan. the first scan writes the announced state file, which tests and callers treat as ready, so a SIGTERM landing between that write and the handler install killed the monitor by signal (
exits 0 on SIGTERMreturnednullon the ubuntu node 24 job for this PR's second head)breaking changes
askJev(state, questions, env)becomesaskJev(state, questions, { env, model }). every caller in the repository is updated; nothing outside the plugin imports ittest plan
already verified
npm teston the committed tree -> 1200 tests, 1199 pass, 0 fail, 1 skipped (the existing skip)the literal guard bites: appending
new Set(["codex", "grok"])tofleet-posture.mjsfailstests/engines.test.mjswith the file and literal named, and reverting restores greenthe scope test bites: removing the
cwdpin fromcalibrate.mjsfails 4 of the 11 calibration testsnode bench/jev/calibrate.mjs --retainedagainst the real API -> 12 of 12 fixtures hold, 29 retained briefs scored, 0 unanswered, 1 flagged (a deliberately flawed probe); the same command run from outside the repository reports the same 29;--model jev-0.0.0exits 1; no key exits 2two intended semantic changes checked by the suites:
fusion-statsresolves the grok data directory through the shared resolver (also honorsHOMEfrom the passed environment), and grok companion lookup gains the codex tie break on equal mtimeslate close fix, measured under a self limiting CPU saturation (two busy loops per core): before, the reproduction failed 9 of 10 runs with
phase: cleanup-requiredorrollout: not_attempted; after, 10 of 10 pass and the six affected cases pass three rounds in a row. widening only the window, with nothing else changed, turned 4 of 5 failures into 8 of 8 passes, which isolates the causenpm testafter the fix, with the machine still at a load average near 49 -> 1200 tests, 1199 pass, 0 fail, 1 skippedmonitor startup order:
node --test tests/jobs-monitor.test.mjs tests/codex-jobs-monitor.test.mjs-> 79/79, fullnpm test-> 1200 tests, 1199 pass, 0 fail, 1 skipped. the race did not reproduce locally in 25 loaded rounds; the fix rests on ordering (the ready signal is now written strictly after the handlers exist), not on a measured ratereviewer should verify
/fusion:smokeand settle it with/fusion:stats --record; expect the same three PASS gates and the same "Recorded accepted for Codex job" and "for Grok job" lines as on 0.0.58engine: codex|grokline"notes
tests/grok-state-lock.test.mjs"concurrent reapers serialize after a lock owner is killed". it imports no fusion code, passes 10 of 10 on an untouched main and 15 of 15 on this tree when idle; tracked in flaky: grok-state-lock 'concurrent reapers serialize after a lock owner is killed' fails under load #62