Skip to content

fix(ci): the image smoke's exec task binds its own management port - #1445

Merged
allisonmahmood merged 2 commits into
mainfrom
ci/image-smoke-exec-binds-own-port
Nov 14, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
ci/image-smoke-exec-binds-own-port

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changed

The server-image job sometimes failed at the smoke's exec step: the supervisor couldn't listen on the management port the script picked for it, because something else held it by then (#1443). The supervisor now binds a port of its own, as local tasks already do.

Closes #1443

Look at

scripts/server-image-smoke.mjs, step 4. freePort() bound 127.0.0.1:0, closed it, and handed the number to the exec container, which binds it about 400 ms later:

[image-smoke] smoke-host-a exited 130 105 ms after SIGTERM
--- smoke-exec
ERROR (#1): ListenerUnavailable: Execution management could not listen on 127.0.0.1:39545.
    [cause]: Error: Failed to start server. Is port 39545 in use?

That's 2 of about 880 runs since 1 November that reached the step. The smoke never calls the management API, so EXECUTION_MANAGEMENT_PORT is now 0. With port 0, the image's supervisor reports what it bound:

Patchy execution supervisor listening on http://127.0.0.1:37705

I could not find which process took the port on the runner. The supervisor's own proxy binds port 0 just before management and could get it, but at about 1 in 7,000 per run that is unlikely. Survivors of the stopped hosts, the sockets they leave, and client connections are ruled out (#1443). Port 0 closes the gap whatever took it.

The step also waits for the supervisor's "listening on" line now. Before, it passed once the supervisor and its standby workerd were running: a supervisor that failed to listen after that exited 1, and stop() accepts any exit but 137.

The hosts' ports and callback ports keep freePort(). The callbacks must be known before either host starts, and that step never failed.

How it was verified

  • The edited script passed locally against the image built by the failing run (server-image-linux-amd64 from run 43508394544), every step through [image-smoke] passed:

    [image-smoke] the exec supervisor runs as root, listens on http://127.0.0.1:41689 and runs workerd as uid 60000
    
  • The server-image job runs it on this PR.

  • Not shown: the flake not coming back. It hit about 1 in 440 runs, so only time shows that.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

CI script only.

  • What does a revert leave behind? Nothing.
  • Does the release before it still work with that? Yes.

Diagnosed and fixed by Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling size:s Under 100 changed lines labels Nov 14, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) found no blocker. Its two notes:

  • Step 4 never waited for management to listen (pre-existing). A supervisor that failed to listen after its processes appeared exited 1, and stop() accepts any exit but 137. Fixed in b064c7c: the step also waits for the supervisor's "listening on" line and names the port. It passes locally against the CI image.
  • "Ruled out" overstated the supervisor's own binds. Its proxy binds port 0 just before management and could get the released port; that is unlikely, not ruled out. Corrected in the PR body and flaky: the server-image smoke's exec task can't bind the management port it was handed #1443. Port 0 covers that case too.

allisonmahmood and others added 2 commits November 14, 2026 17:00
The smoke picked a free port, released it, and passed the number to the
exec container, which binds it about 400 ms later. Twice in about 880
runs since 1 November something else held it by then, and the job failed
with "Execution management could not listen on 127.0.0.1:<port>".

The smoke never calls the management port, so the supervisor now binds
port 0, as local tasks already do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step 4 passed once the supervisor and its standby workerd were running.
A supervisor that then failed to listen exited 1, and stop() accepts any
exit but 137. The step now also waits for "listening on" and names the
port.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the ci/image-smoke-exec-binds-own-port branch from b064c7c to 26fc26b Compare November 14, 2026 16:00
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 26fc26b01491981caa0411642ee3a7917135a19b (base df62e7f319abd15ecad1d2c34010407b148f6ed6) on throwaway image-smoke fixtures with TLS/SCRAM-only scratch Postgres, by GPT-6.1 Sol (xhigh) in the Codex harness (T3 Code). I did not write this change.

Done means

  • The exec supervisor binds its own management port: passed. The checkout matched headRefOid and was clean. The unchanged node scripts/server-image-smoke.mjs --image patchy-server:ci passed under Node 24.20.0. EXECUTION_MANAGEMENT_PORT=0 yielded a nonzero management listener, with the root supervisor and workerd running as UID 60000.
  • Readiness requires the management listener: passed. A temporary Docker CLI shim withheld only the listener announcement. The unchanged script exited 1 at its 120-second readiness deadline while both required processes were running. This expected failure closes the previous false-pass path.
  • Compatibility with the rebased workerd startup: passed. The fault run directly observed standby workerd using --control-fd=3, alongside the actual management listener. The full smoke passed with this head's image, rather than reusing the previous head's image.
  • Existing image smoke behavior: passed. Both hosts booted; signed-out font serving, TLS and certificate-name refusals, promotion, rollback, SIGTERM shutdown of all three tasks, and the older node command's pinned Bun fallback passed.

Used server-image-linux-amd64 from this head's successful image workflow. Its metadata names merge commit 3ca7998c0964556cd7b28affba9f166b346e9e33; I verified its parents are the base and checked head above, and its tree is identical to the checked head. CI's image build, reproducibility comparisons and image smoke passed. Local dependency installation and script syntax checking passed.

Local evidence
[image-smoke] host a (smoke-a) served /healthz 2109 ms after start
[image-smoke] a signed-out page loads /assets/fonts/Geist-Variable-3626eba547294501.woff2 from the image
[image-smoke] host b (smoke-b) served /healthz 1991 ms after start
[image-smoke] connecting by IP, which the certificate does not name is refused
[image-smoke] connecting without TLS is refused
[image-smoke] promoted smoke-b
[image-smoke] promoted smoke-a
[image-smoke] smoke-host-b exited 130 170 ms after SIGTERM
[image-smoke] smoke-host-a exited 130 165 ms after SIGTERM
[image-smoke] the exec supervisor runs as root, listens on http://127.0.0.1:39699 and runs workerd as uid 60000
[image-smoke] smoke-exec exited 130 146 ms after SIGTERM
[image-smoke] `node` runs Bun 1.4.4
[image-smoke] passed

Fault injection:

management_port_zero: true
real_listener_nonzero: true
saw_root_supervisor: true
saw_nonroot_workerd: true
saw_workerd_control_fd: true
Error: The exec supervisor did not listen for management and start its standby workerd as another uid within 120 s

The fault run exited 1 as expected. Every heavy/Docker command used /tmp/patchy-heavy-suite.lock; the fixed container names were absent before each run. Both runs shut down their scratch Postgres. Final checks confirmed no smoke containers remained and Docker image IDs matched the pre-run inventory. No dev instance was started; the checkout remains clean.

Golden journeys

  • No golden-journey implementation changed. Local image checks passed for signed-out serving and execution startup. The head's clerk-live, both cli-smoke jobs and tier2-smoke passed in CI; browser coverage was still pending when checked, as recorded below.
  • Surface audit: only the CI smoke script changes. No wire contract, CLI, dev-loop, vocabulary/product, migration, company-resource, served-page implementation, reverse-state or repo-layout changes apply.

Rollback answers: They match the diff. Reverting this CI-script-only change leaves no deployed schema, data, external effects or runtime contract behind; the previous release remains compatible. No one-way label is needed.

Not run

  • A long recurrence soak: the reported flake rate was about 2 in 880 runs. This run verifies port-0 startup and the readiness failure behavior, not long-term frequency.
  • A local image rebuild or full local pnpm verify: used the exact head workflow's artifact, passing build/reproducibility checks and available CI results instead.
  • Completed broader CI coverage: test (22), test (24), browser and browser-firefox were still pending at the final check. These are not counted as passed. The other applicable reported checks passed, including server-image, test (26), test (bun), lint, Postgres concurrency and rollback rehearsal.

Notes

  • No blocker found in the behavior checked. The pending broader CI jobs and unmeasured recurrence rate remain explicit limits of this verdict.

@allisonmahmood
allisonmahmood merged commit 6da1fa2 into main Nov 14, 2026
27 checks passed
@allisonmahmood
allisonmahmood deleted the ci/image-smoke-exec-binds-own-port branch November 14, 2026 16:17
allisonmahmood added a commit that referenced this pull request Nov 15, 2026
#1456)

## What changed

This adds release 44's What's new entry, written from `b653816`. It
covers everything merged since release 43's `through` (`1cbd39f`), and
sets the `patchy` release to `0.44.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Connect GitHub | #1448, #1451 |
| New: Pin patches to your sidebar | #1437 |
| Improved: Patchy works in Firefox | #1427 |
| Improved: Your agent's Patchy skill keeps up | #1446 |
| Fixed: Dialogs close in Firefox | #1427 |
| Fixed: Publishing a tool no longer fails by chance | #1444 |
| Behind the scenes: agents read what each tier means before picking one
| #1438 |

#1445 is CI only and has no line. #1422 is release 43's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **GitHub is announced because this deploy makes it available.** The
production App is registered and its five settings are in place, so
GitHub is offered in Integrations once this ships. The code was run
against real GitHub before it merged (#1451). One check stays open on
#1440: someone who administers a repository without owning its
organization. That case fails closed until it is shown.
- **One test changed with it.** With GitHub off, a test searched the
whole catalogue page for the word "GitHub". The entry puts that word in
the What's new bell on every page, so the test now checks for the
catalogue's own GitHub card and link instead.
- **`pidgeon-suite` and `pidgeon-live` are red for a reason outside this
release:** Pidgeon is retiring the API the integration calls (#1457).
Neither is a required check, and this release neither fixes nor worsens
it.
- **Rollback safety, from the live commit `5decfef` (release 43) to this
PR's merge.** #1448 and #1451 are labelled `one-way`; the rest are not,
and each says release 43 reads what it leaves.
- #1448 adds migration 43's three tables and five host settings. Release
43 ignores both, and the rollback rehearsal passed on #1448's head.
  - #1437 adds a personal pins table that release 43 never reads.
- A patch version that declares a GitHub connection is what release 43
can't read. None can exist before this release.

If this release misbehaves, roll back to `5decfef` (release 43) while no
patch version declares a GitHub connection. Once one does, rolling back
past #1448 would break that patch, because release 43 can't read a
`github` declaration; fix forward instead.

## How it was verified

`pnpm format:check`, the What's new tests, the API suites and GitHub's
page tests pass locally.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

- **What does a revert leave behind?** Nothing: the entry and the
version number are in the tree.
- **Does the release before it still work with that?** Yes.

Written by Claude Fable 5.2 in Claude Code, through T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flaky: the server-image smoke's exec task can't bind the management port it was handed

1 participant