## Outcome
The rebuild entry-lock test no longer depends on the host Docker daemon,
so a slow daemon can no longer push its rebuild child past the deadline.
Its rebuild child now loads while the lock holder starts, which cuts the
test's local runtime by about 1 s.
## Reason
`src/lib/actions/sandbox/rebuild-entry-lock.test.ts` failed in
`cli-test-shards (2)` on #14671 with `spawnSync … ETIMEDOUT` (run
44642864306, all three attempts, and job 135868445292). All four
failures came from the `missing` case, whose child loads only about 240
source modules. The `registered` case passed in 4.6 s in the same run,
and it loads about 920 modules. So TypeScript compilation was not the
cause.
Loading `src/lib/runner.ts` runs `detectDockerHost()`, which calls the
real `docker version` up to three times with 3 s deadlines. A daemon
that answers slowly can therefore cost about 9 s before the preflight
starts. Locally, a host `docker` that answers after 2.8 s makes the
unchanged test fail with the same `ETIMEDOUT` in both cases.
### Related issues
Fixes #14689
## Changes
- Put a `docker` that exits 1 on the test's private `PATH`
(`testHome.bin`). The preflight under test needs no Docker, and both
children now ignore the host daemon.
- Start the rebuild child together with the lock holder. The child loads
its entry module, prints `ready`, and calls `rebuildSandbox` or
`dispatchCli` only after the parent sees both processes ready and the
lock files exist. The test then writes to the child's stdin.
- Replace the 10 s `spawnSync` with an asynchronous child whose 20 s
deadline is based on CI blob reports. Those reports show passing shards
ran each case in 2.2–4.7 s, including lock-holder startup. On a timeout,
the child's stderr appears in the assertion message.
- Keep all existing assertions: exit status 1, the framed stderr
(preflight, onboarding, holder PID, wait, do not delete the lock,
aborting, untouched sandbox), and unchanged registry, onboarding lock,
and host-lock owner bytes.
The rebuild still runs in its own process. An in-process version passed
but was slower in CI coverage mode. With `--coverage`, the cold import
of the 916-module rebuild graph took 17.4 s, compared with 5.1 s for the
child.
## Verification
- `npx vitest run --project cli
src/lib/actions/sandbox/rebuild-entry-lock.test.ts`: passed 3 times. The
registered case took 4.5–4.7 s and the missing case took 0.94–0.97 s.
Before the change, they took 5.1 s and 1.4 s. The file took 5.6–5.8 s,
compared with 6.6–7.0 s before.
- Same file with CI coverage flags (`CI=true CLI_SHARD=2
CLI_SHARD_COUNT=12 … --coverage`): passed in 4.5 s and 0.95 s. Before
the change, it took 5.1 s and 1.4 s.
- Slow-daemon reproduction, using a host `docker` that sleeps 2.8 s and
exits 1 first on `PATH`: before the change, both cases failed with
`spawnSync … ETIMEDOUT` after 20.8 s and 18.9 s. After the change, both
passed in 4.5 s and 0.96 s.
- A temporary marker in the fake `docker` confirmed that the Docker
probes reach the fake and not the host daemon.
- Deliberate break: `withRebuildHostFence` was changed to return
silently on lock contention. Both cases failed: registered with
`expected +0 to be 1`, and missing with `expected … to contain
'onboarding'`. The break was then reverted.
- A local reproduction of #14671's shard 2 with CI coverage flags
passed. The registered case took 3.6 s and the missing case took 1.4 s.
- `npm run test-size:check` passed (7/7). `npm run test:titles:check`,
`oxlint`, `oxfmt --check`, and `tsc -p tsconfig.cli.json --noEmit` also
passed.
- The pre-commit and pre-push hooks passed, including publication
validation and the TypeScript checks for the CLI, plugin, and JS config.
- The diff changes one test file and contains no secrets, API keys, or
credentials.
---
Signed-off-by: Carlos Villela <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
Outcome
Before: PRs into
v1and PRs stacked on them got thev1label only when someone added it by hand. After: a new workflow addsv1to every PR whose base isv1, or whose chain of stacked PR bases reachesv1, when the PR is opened, reopened, or retargeted. It also labels the open PRs stacked on such a PR.Reason
cv asked for every PR into
v1, including stacked PRs, to carry thev1label from now on.This PR targets
main, notv1. Since December 8, 2025, GitHub runspull_request_targetfrom the default branch's copy of a workflow, whatever the PR's base. A copy onv1would never run. This repository shows that behavior:require-maintainer-edits.yamlexists only onmain, and it runs forv1PRs such as #14669. Workflows onmainthat filterbranches: [main], such aslabel-merged-pr-release-target.yaml, skipv1PRs. This workflow has no branch filter.Changes
.github/workflows/label-v1-prs.yaml: apull_request_targetworkflow foropened,reopened, andedited. The job skips edits that don't change the base and PRs into the default branch. It runs an inlineactions/github-scriptstep, pinned to the same SHA as the repository's other workflows. The step only reads PR metadata and adds labels. It never checks out or runs PR code, and its token has onlypull-requests: write.v1(label), the default branch, a branch that isn't such a PR's head, a loop, or after 10 ancestor PRs (no label).v1, it labels the PR and the open PRs stacked on it, up to 10 levels. Retargeting a parent ontov1therefore labels its children. It doesn't descend from fork heads,v1, or the default branch.test/automation/pull-requests/label-v1-prs-workflow.test.tsruns the workflow's script against a fake GitHub API. It covers stacks of open and merged PRs, every stopping case, the depth limit, labelling stacked children, and existing labels.test/helpers/vitest-watch-triggers.tsselects that test when the workflow changes.Limitation: a child opened before its parent exists in the chain is labelled only when the parent PR is later opened or retargeted onto the chain. Retargeting a PR away from
v1doesn't remove the label.Verification
npx vitest run test/automation/pull-requests/label-v1-prs-workflow.test.ts— 12 passed. Before the workflow existed, the suite failed. Raising the depth limit to 11 failed the depth test. Removing the default-branch guard failed the merge-into-v1test.actionlint .github/workflows/label-v1-prs.yaml— no findings.pull_request_targetworkflows frommain. After merge, open a PR intov1, or a PR stacked on one. Then confirm that Automation / Label v1 Pull Requests runs and addsv1.Review notes
.github/**is a contributor sensitive path. This adds apull_request_targetworkflow with write access to PRs. No review happened before publication, so the change awaits maintainer review.Signed-off-by: Carlos Villela [email protected]
Summary by CodeRabbit
v1when their base branch chain leads tov1. The label is also applied to eligible open pull requests stacked on those branches.