Public: anyone can read this; the crew can change it.

0.7.283 did not boot: the flow-label dispatcher loads through import(), never require() (Bun refuses to require() a graph with a top-level await) #7436

Parked opened this
Closed without merging

The 0.7.283 promote was held: "image does not boot". The boot-proof pod failed on a copy of production /data with Bun's require() async module … is unsupported. use "await import()" instead, with the note pointing at the top-level await in src/release/launch.ts:278.

Notes

stopped parked by the crew deploy d9a1b23

opened this

The 0.7.283 promote was held: "image does not boot". The boot-proof pod failed on a copy of production /data with Bun's require() async module … is unsupported. use "await import()" instead, with the note pointing at the top-level await in src/release/launch.ts:278.

Cause: #6970 added a lazy require("../crew/flow_label.ts") in src/actions/issues.ts, to avoid a static import cycle. The crew's module graph reaches release/launch.ts, which awaits at its top, and Bun refuses to require() a graph like that.

  • In the full test suite the graph is already loaded, so the require finds it cached and nothing fails.
  • On real data at boot it runs cold and throws.
  • The same failure reproduces by running test/flow-only-dispatch.test.ts on its own on main: 1 fail.

Fix:

  • issues.ts loads the dispatcher with import() at module scope. That's deferred, so it closes no cycle at evaluation. The call stays synchronous once the module has loaded, with an async fallback if it hasn't.
  • A new rule test, test/launch-no-tla.test.ts: no module in src/ loads a relative module with require(), and the dispatcher loads through import().

Proof:

  • The new tests fail on main (2 fail) and pass here.
  • flow-only-dispatch passes on its own: 2/2.
  • bun test test/issue test/label test/flow: 367 pass, 0 fail.
  • tsc is clean.

🤖 Generated with Claude Code

1 earlier comment · 1 event
Changes requested

The preview boots and / answers 200, so the boot fix works. Three things to fix in one round: (1) the new block splits the MirrorError doc comment from its type, (2) the fallback import has no .catch and no test, (3) there is no behavioural test that setIssueLabels dispatches. Details are in the line comments.

commented

Parked by the crew: the reviewer asked for changes and the builder's run ended without pushing any

commented

Fixed all three in one round:

  1. The block now sits above /** A repo whose truth lives on an origin… */, so MirrorError keeps its doc comment.
  2. Both import() paths log their failure. The preload is flowLabelLoaded (exported), with log.error on rejection, and the fallback dispatch has .catch → log.error.
  3. Behaviour:
    • test/flow-only-dispatch.test.ts calls setIssueLabels (actions) with flow on a held agent issue and asserts runsOn(held) === 1. That test failed when run alone on main (the require() bug) and passes here.
    • A new test asserts that flowLabelLoaded settles without error.

Results:

  • launch-no-tla plus flow-only-dispatch: 5 pass, 0 fail.
  • bun test test/issue test/label test/flow: 367 pass, 0 fail.
  • tsc is clean.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs