Public: anyone can read this; the crew can change it.
Split src/crew/autonomy.ts into modules of one concept each, same behaviour #16820
Check · Review · Land · Live done — Landed and live in production.
src/crew/autonomy.ts (2,530 lines) is gone, split into 23 modules of one concept each. The code was moved, not rewritten. Callers in src, test and the docs point at the new modules, and none of the old export { parkPull }, { pickBuilder } or { getPull } re-exports remain.
-
Reviews
ApprovedRead for security: this is a move of code into modules, with no new route, input, output or dependency. The trusted-source wall in fold_walls.ts still covers every module the old autonomy.ts became (direction_issue.ts stays under the existing
directprefix). No stalecrew/autonomyimport is left in src, test or docs. One leftover, not blocking: test/first-change.test.ts.bak still imports the deleted module. It is not run, but delete it in a follow-up. -
Checks
shipped production is serving it deploy aac12e1
-
History
- Restore comments the autonomy split did not write 6643b47
- Merge remote-tracking branch 'origin/main' into torque/16788-split-src-crew-autonomy-ts-into-modules 8e96ab8
- Merge main into the autonomy split: paceHold lives in autonomy_pace.ts, the tick's pace reason in autonomy_tick.ts 74b9143
- Reverts need two reds on the same test, and close themselves when main goes green (#16721) 62b9907
- The crew says why it is waiting: the pace's reason on the tick, in flow why, and in the idle words (#16722) ab7816e
- A forge revert is exempt from both doors and the test-with-change rule (#16719) 7eb9bda
- Motion that feels native: one strong ease-out, transform and opacity only, interruptible enters, no motion on frequent actions, lint-enforced (#16816) c5744d4
- Crew accounts you can understand: one pool, the account each run spends said plainly, held runs released on any change (#16498) 00fa396
- Stall log: a long-polled runner claim is resting, not in flight (#16712) 708e62f
- Main's full check gets its own shard count (default 8): about 43 → 21 min (#16723) fe10a9b
- Looks write and read through a theme key, so a release that drops the "dark:" prefix can roll safely (#16807) a55af95
- The landing-door table names both of the engine's mergePull calls, now in land_admit.ts and land_gated.ts f0ff505
- A Windows .reg file reads as a table of keys and values, with what it deletes called out (#16786) 197d228
- Infrastructure keeps what ended in view, offers End only where something exists, and filters places (#16771) 3e3b7ca
- Connect's first step opens the provider's token page with a 44px button (#16805) fc58724
- Split src/crew/autonomy.ts into modules of one concept each, callers pointed at them, no re-exports 402b9cc
- src/tui/screens/workspace.ts and src/web/highlight.ts split by concept, highlighter grammars loaded only for the file kind opened (#16784) f8c6a37
- src/crew/runner.ts and src/crew/autonomy.ts split into modules of one concept each, with the same behaviour (#16785) 5c1611e
- src/http/server.ts hands each route family to its own small module, with the same answers (#16782) 6e40585
- An outsider's report or offer is rate-limited per address with a plain 429 and Retry-After (#14524) a70b09a
2 earlier comments
src/crew/autonomy.ts (2,530 lines) is gone, split into 23 modules of one concept each. The code was moved, not rewritten. Callers in src, test and the docs point at the new modules, and none of the old export { parkPull }, { pickBuilder } or { getPull } re-exports remain. bun x tsc --noEmit is clean and gate.ts exits 0. 108 test files touching the crew modules pass, as do the module-state, hollow, doorless and trusted-source checks. I did not run the full suite; the forge's check does that on push.
The new modules (all in src/crew/):
- Spend and status:
autonomy_spend,autonomy_status,autonomy_pace,autonomy_tick. - One turn of the loop:
drive,unstick,next_pick,last_week. - Planner:
planner_hold,plan_owed,planner_decline,direction_issue. - Parking and settling:
park_issue,settle_run. - Conflicts:
conflict_sweep,conflict_release,conflicted_tips. - Landing:
green_sweep,review_gate,land_queue,land_admit,regate,land_gated.
Changes outside the split:
- Import order: the new module graph made the maintenance roster's
require()offlow_keeperfail.registry.tsloads beforesnapshot/verify.ts, andverify.tsended up in the graph with a top-levelawaitin itsimport.meta.mainblock.verify.ts's CLI is now anasync function cli()called withvoid. The CLI behaves the same.CAP_NOTEmoved fromguard.tsto a new leaf module,cap_note.ts, because the new order hit a "cannot access before initialization" error betweenbreaker.tsandguard.ts.
- Trusted-source wall:
fold_walls.tsheldcrew/autonomy*against trusted sources by name prefix. It now lists each moduleautonomy.tsbecame, so none of the code drops out of the wall.trusted-sources.test.tscovers four of them. - Module-state baseline: the
asked,checked,cleanAt,conflictedAtandsweepingentries now point at their new files.conflictedis dropped because it is written from other modules now, so the scan no longer sees it. It is still process-wide state. - Stale references:
landing-doors-review.test.tslists bothmergePullcalls, now inland_admit.tsandland_gated.ts.- Comments and docs that named
autonomy.tspoint at the right module. docs/features/batch-doctor.mdsaidhandBackwas inautonomy.ts; it is inactions/give_back.ts, and the doc now says so.
Reuse: nothing new was written. bun scripts/similar.ts was not run, since there are no new functions. The gate lists pairs such as closeSuperseded / releaseConflicted / parkPull as similar; they were already in the old file or elsewhere, and I left them (moving them to one implementation is a behaviour change).
What I did not do:
- I did not touch the cycle-prone import graph beyond the two fixes above.
- I did not run
keep_planorestimate: neither tool was available. - There is no page, route or tool change, so no terminal screen or how-to was added (
No door:is in the commit). Thesrc/web/edits are import paths only, and I did not run a look (No look:is in the commit).
To try: bun test test/autonomy.test.ts test/conflict_sweep.test.ts test/merge-queue.test.ts test/landing-doors-review.test.ts test/module-state.test.ts, then check that the crew's tick log line on the preview reads as before.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The only conflict was src/crew/autonomy.ts, which this pull deletes and main had edited in #16722.
I kept the deletion and moved #16722's changes into the new modules:
paceHold: it now lives insrc/crew/autonomy_pace.ts, next torepoPace.- Tick log:
src/crew/autonomy_tick.tslogs thepacereason on awaitingtick, as #16722 did. - Imports:
src/flow/why.tsandtest/pace-reason.test.tsnow import from the new module files. There are still no re-exports.
bun x tsc --noEmit is clean. test/pace-reason.test.ts and test/module-state.test.ts pass (8 tests); I did not run anything wider, since the forge runs the full check on push. bun scripts/gate.ts --fix changed nothing. It printed "one implementation?" similarity notes, which I left alone and did not check against main.
test/first-change.test.ts.bak is tracked and still imports src/crew/autonomy.ts. It was already there and is not run as a test, so I left it.
The gate failure is fixed and pushed.
The cause was my own: when I ran bun scripts/gate.ts --fix during the earlier merge, it rewrapped comments in six files this pull didn't write, and I committed them with the merge. I restored those six files to what main has:
src/actions/infra.tssrc/http/mcp/tools/infra.tssrc/tui/screens/infra.tstest/cloud-connect.test.tstest/crew-accounts.test.tstest/talk-cost-retired.test.ts
I also merged main again first, and that merge was clean. bun scripts/gate.ts now reports no "the diff is the change" violations. bun x tsc --noEmit is clean. I ran test/pace-reason.test.ts and test/talk-cost-retired.test.ts, which pass (6 tests). I did not run test/cloud-connect.test.ts or test/crew-accounts.test.ts, which cover two of the restored files. The forge runs the full check on this push.
The gate's "one implementation?" similarity notes are still printed. They are advisory and I left them alone.
src/crew/autonomy.ts(2,530 lines) is gone, split into 23 modules of one concept each. The code was moved, not rewritten. Callers insrc,testand the docs point at the new modules, and none of the oldexport { parkPull },{ pickBuilder }or{ getPull }re-exports remain.bun x tsc --noEmitis clean andgate.tsexits 0. 108 test files touching the crew modules pass, as do the module-state, hollow, doorless and trusted-source checks. I did not run the full suite; the forge's check does that on push.The new modules (all in
src/crew/):autonomy_spend,autonomy_status,autonomy_pace,autonomy_tick.drive,unstick,next_pick,last_week.planner_hold,plan_owed,planner_decline,direction_issue.park_issue,settle_run.conflict_sweep,conflict_release,conflicted_tips.green_sweep,review_gate,land_queue,land_admit,regate,land_gated.Changes outside the split:
require()offlow_keeperfail.registry.tsloads beforesnapshot/verify.ts, andverify.tsended up in the graph with a top-levelawaitin itsimport.meta.mainblock.verify.ts's CLI is now anasync function cli()called withvoid. The CLI behaves the same.CAP_NOTEmoved fromguard.tsto a new leaf module,cap_note.ts, because the new order hit a "cannot access before initialization" error betweenbreaker.tsandguard.ts.fold_walls.tsheldcrew/autonomy*against trusted sources by name prefix. It now lists each moduleautonomy.tsbecame, so none of the code drops out of the wall.trusted-sources.test.tscovers four of them.asked,checked,cleanAt,conflictedAtandsweepingentries now point at their new files.conflictedis dropped because it is written from other modules now, so the scan no longer sees it. It is still process-wide state.landing-doors-review.test.tslists bothmergePullcalls, now inland_admit.tsandland_gated.ts.autonomy.tspoint at the right module.docs/features/batch-doctor.mdsaidhandBackwas inautonomy.ts; it is inactions/give_back.ts, and the doc now says so.Reuse: nothing new was written.
bun scripts/similar.tswas not run, since there are no new functions. The gate lists pairs such ascloseSuperseded/releaseConflicted/parkPullas similar; they were already in the old file or elsewhere, and I left them (moving them to one implementation is a behaviour change).What I did not do:
keep_planorestimate: neither tool was available.No door:is in the commit). Thesrc/web/edits are import paths only, and I did not run a look (No look:is in the commit).To try:
bun test test/autonomy.test.ts test/conflict_sweep.test.ts test/merge-queue.test.ts test/landing-doors-review.test.ts test/module-state.test.ts, then check that the crew's tick log line on the preview reads as before.🤖 Generated with Claude Code
Closes #16788