Skip to content

perf(lane): fold at admission and allow byte-equal --locked folds - #313

Merged
ScriptedAlchemy merged 3 commits into
masterfrom
perf/fold-at-admission
Sep 26, 2026
Merged

ScriptedAlchemy merged 3 commits into
masterfrom
perf/fold-at-admission

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Two folding fixes found while diagnosing a 62-deep queue on a 96-core host.

  1. lane-exec.ts: the batch fold ran when a lane picked its next job, before that job waited (often ~30 min) for an admission permit. Compatible jobs arriving during the wait ran separately and each waited for their own permit. The fold now runs once the job holds its permit; it is uninterruptible so a concurrent kill still settles cleanly.
  2. batch.ts: --locked, --frozen and --offline were unmodelled flags that disqualified folding. Byte-equal sets now fold; a mismatch on either side still refuses.

Replaying the last 24 h of this host's history: +9 folds/day, ~282 min/day less agent waiting. New tests fail on the old code and pass with the change; pnpm run check passes (1,324 unit/integration, 50 route, 3 browser). Changeset and README note included.

@changeset-bot

changeset-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b86e9de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
cargo-hauler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T23:58:25.983897Z 4e0d6d5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The lane took its head, waited the batch window, folded compatible pending
requests, then parked the head at the admission gate and on the permit
semaphore. Under a saturated pool that park lasts tens of minutes, and every
compatible request that joined the lane meanwhile stayed pending, ran after
the head on its own, and waited out a permit of its own.

The fold now runs once the head holds its permit, uninterruptibly so a
racing kill settles a fully folded composite. The fold predicates are
unchanged.

Live evidence on a 12-permit, 27-lane queue: cc-1626
(`test -p tracedecay-agent-hosts --lib -- …`) was submitted 0.4 s after
cc-1625 (`test -p tracedecay-mcp --lib -- …`), missed the 150 ms window,
and queued behind a head that waited over 15 minutes for a permit. Replaying
the last day's ledger, 5 runs would have folded, avoiding 139 minutes of
wait.
Any unmodeled cargo flag kept a request out of every compile batch and
test composite, and `--locked` is the most common one: 335 of the 1,319
brokered leaders in the last day carried it. The three flags assert
lockfile and network state for the whole invocation and never select or
shape a package's units, so participants that make the same assertions
can share the leader's argv. A one-sided flag still refuses the fold: the
composite would forbid a follower's lockfile update or apply one it
forbade.

Replaying the last day's ledger with admission-time folding, this lifts
the folds from 5 to 9 runs and the wait they avoid from 139 to 282
minutes.
@ScriptedAlchemy
ScriptedAlchemy merged commit e9e60d6 into master Sep 26, 2026
@ScriptedAlchemy
ScriptedAlchemy deleted the perf/fold-at-admission branch September 26, 2026 01:06
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