cmux-tui pin: the PR probe waits for main's merge-tree publisher (cx-73f2)
Summary
This is the feat-cmux-next half of #19615, which adds main's merge-tree publisher (cx-73f2).
A same-repository PR's token can't create the cmux-tui-pin-* ref or dispatch the artifacts run; it gets a 403. So pin-cmux-tui.sh probe failed same-tree cmux-tui immediately, 55 times on 33 PRs in a day.
Once #19615 is on main, the same push also starts its pull_request_target publisher. Now, when the probe can't start a publisher itself, await_outside_publisher waits for one:
- It waits up to 90 s by default (
CMUX_TUI_TREE_PUBLISHER_WAIT_SECONDS; path routing has 5 minutes). - It looks for an artifacts run for the merge commit, or for one with the same tree, and defers to it. Deferring is the existing
deferredpath: that run's publish starts the tree jobs. - If no publisher shows up, the check fails exactly as before.
- It applies to pull requests only. Other callers keep their own waits.
Testing
scripts/cmux-next/tests/pin-cmux-tui-probe.test.sh gets a new case (d): every write is refused, and a publisher run appears 2 s later.
- Red at 50f58926dbd3: the probe printed the production error and failed.
- Green after: the probe defers to the run.
- With no publisher it still fails, within the bounded wait.
pin-cmux-tui, -run-check, -resolve-newest and -host-target tests are green, and shellcheck is clean.
Changelog
none
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes the cmux-tui pin probe failing immediately on same-repository pull requests, whose token gets a 403 when creating the pin ref or dispatching the artifacts run.
When the probe can't start a publisher itself, it now waits for main's pull_request_target merge-tree publisher (started by the same push):
- Waits up to 90s by default (
CMUX_TUI_TREE_PUBLISHER_WAIT_SECONDS; path routing gets 5 minutes) for an artifacts run for the merge commit or one with the same tree, and defers to it. - Applies to pull requests only; other callers keep their own waits.
- If no publisher appears, the check fails exactly as before.
- The second same-tree probe sets
CMUX_TUI_TREE_PUBLISHER_WAIT_SECONDSto 0, since the first already waited.
Adds test case (d): every write is refused, with a publisher run appearing 2s later; the probe defers to it, and fails bounded without one.