Skip to content

ci: label pull requests that lead to v1 - #14671

Merged
cv merged 2 commits into
mainfrom
cv/label-v1-prs
Nov 20, 2026
Merged

cv merged 2 commits into
mainfrom
cv/label-v1-prs

Conversation

@cv

@cv cv commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Outcome

Before: PRs into v1 and PRs stacked on them got the v1 label only when someone added it by hand. After: a new workflow adds v1 to every PR whose base is v1, or whose chain of stacked PR bases reaches v1, 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 the v1 label from now on.

This PR targets main, not v1. Since December 8, 2025, GitHub runs pull_request_target from the default branch's copy of a workflow, whatever the PR's base. A copy on v1 would never run. This repository shows that behavior: require-maintainer-edits.yaml exists only on main, and it runs for v1 PRs such as #14669. Workflows on main that filter branches: [main], such as label-merged-pr-release-target.yaml, skip v1 PRs. This workflow has no branch filter.

Changes

  • .github/workflows/label-v1-prs.yaml: a pull_request_target workflow for opened, reopened, and edited. The job skips edits that don't change the base and PRs into the default branch. It runs an inline actions/github-script step, 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 only pull-requests: write.
    • It follows the base branch through the open PR, or else the latest merged PR, whose head is that branch in this repository. It stops at v1 (label), the default branch, a branch that isn't such a PR's head, a loop, or after 10 ancestor PRs (no label).
    • When the PR leads to v1, it labels the PR and the open PRs stacked on it, up to 10 levels. Retargeting a parent onto v1 therefore labels its children. It doesn't descend from fork heads, v1, or the default branch.
    • Adding a label the PR already has is skipped, and it never removes labels.
  • test/automation/pull-requests/label-v1-prs-workflow.test.ts runs 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.ts selects 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 v1 doesn'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-v1 test.
  • actionlint .github/workflows/label-v1-prs.yaml — no findings.
  • pre-commit and pre-push hooks, including publication validation, passed.
  • The workflow can't run on this PR: it exists only on this branch, and GitHub reads pull_request_target workflows from main. After merge, open a PR into v1, or a PR stacked on one. Then confirm that Automation / Label v1 Pull Requests runs and adds v1.
  • The diff contains no secrets, API keys, or credentials.

Review notes

.github/** is a contributor sensitive path. This adds a pull_request_target workflow 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

  • New Features
    • Pull requests targeting non-default branches are labeled v1 when their base branch chain leads to v1. The label is also applied to eligible open pull requests stacked on those branches.
  • Tests
    • Added coverage for labeling behavior, including retargeted pull requests, existing labels, and cases where the branch chain does not qualify.

Add a pull_request_target workflow that adds the v1 label to PRs whose
base is v1 or whose chain of stacked PR bases reaches v1, and to open PRs
stacked on such a PR. It lives on main because GitHub runs
pull_request_target from the default branch's copy of a workflow.

Signed-off-by: Carlos Villela <[email protected]>
@cv cv self-assigned this Nov 20, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

A new workflow traces eligible pull request base branches to v1 and labels matching pull requests, including eligible stacked pull requests. Tests cover branch-chain limits and stopping conditions.

Changes: V1 Pull Request Labeling

Layer / File(s) Summary
Base-chain tracing, labeling, and validation
.github/workflows/label-v1-prs.yaml, test/automation/pull-requests/label-v1-prs-workflow.test.ts, test/helpers/vitest-watch-triggers.ts
The workflow handles opened, reopened, and base-edited pull requests that target non-default branches. It traces eligible parent pull requests to v1, then labels the pull request and eligible stacked pull requests. Tests cover stopping conditions, lookup limits, existing labels, and fork branches. The watch trigger runs these tests when the workflow file changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant PullRequestEvent
  participant LabelV1Workflow
  participant GitHubPullRequestsAPI
  PullRequestEvent->>LabelV1Workflow: Open, reopen, or base edit
  LabelV1Workflow->>GitHubPullRequestsAPI: Look up eligible parent pull requests
  GitHubPullRequestsAPI-->>LabelV1Workflow: Return matching pull requests
  LabelV1Workflow->>GitHubPullRequestsAPI: Add v1 label to eligible pull requests
Loading

Suggested labels: area: ci

Suggested reviewers: rsliter, deepujain, prekshivyas

Merge Risk: Minimal · up to afbb0

This adds an automation workflow that labels pull requests leading to v1, directly or through stacked PRs, along with tests for the tracing logic. It does not change product behavior, and the worst case is a missing or extra label. The workflow cannot be exercised until it exists on main, so confirm the first real run after merge.

Security architecture risk: Minimal · up to afbb0

The workflow keeps the privileged operation narrowly scoped to adding a fixed label. It does not check out or execute pull-request code, and repository-identity checks prevent same-named fork branches from supplying ancestry. No introduced security or material failure-containment issue was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A contributor able to open or retarget a PR can trigger privileged metadata processing. The token has repository-level pull-request write authority, while the inspected script limits its mutation to adding v1 in the current repository. A qualifying same-repository stack can affect multiple PRs; traversal depth is bounded, but no separate total-PR count limit is implemented.

Trust Boundaries and Controls

  • observed — The privileged event context is separated from PR code execution by a fixed inline script with no checkout. Repository full-name equality and exact branch matching prevent a fork's same-named head from supplying ancestry; fork heads also cannot extend descendant propagation.

Resilience and Maintainability Implications

  • inferred — Label additions are repeatable and non-destructive, so overlapping runs can cause redundant additions rather than destructive updates. Propagation is not atomic: an API error or timeout can leave the root and only some descendants labeled. A later qualifying run can resume additions, but the script has no explicit reconciliation or compensation, and it uses event-time metadata without revalidating a subsequent retarget.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "ci: label pull requests that lead to v1" matches the main change: a new pull_request_target workflow that labels PRs whose base chain reaches v1, plus stacked open descendants. It is specif…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "ci: label pull requests that lead to v1" matches the main change: a new pull_request_target workflow that labels PRs whose base chain reaches v1, plus stacked open descendants. It is specific and concise, and it names the label target. The conventional-commit prefix "ci:" fits the .github workflow change, and the accompanying test and trigger-map updates are supporting work.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 74ccd7a and afbb0f2.

Files selected for processing: 3

  • .github/workflows/label-v1-prs.yaml
  • test/automation/pull-requests/label-v1-prs-workflow.test.ts
  • test/helpers/vitest-watch-triggers.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@cv

cv commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness recorded Pi 1.5.2 (session format v3), helper agent started by another Pi agent Session metadata and install path
Skills recorded nemoclaw-contributor-create-pr (complete read of main's SKILL.md, references/validation.md, references/publication.md) Reads to cutoff
Instruction files partial v1 AGENTS.md (injected); .github/PULL_REQUEST_TEMPLATE.md (complete read); .github/SESSION_REPORT_TEMPLATE.md (complete read) main's AGENTS.md was read only in part and is not counted
Tool calls recorded typescript: 33 Includes failed calls, through this report's posting; the wrapper hides nested shell and GitHub calls
Session window recorded 2026-11-19T23:51Z to 2026-11-20T00:06Z; 15 min First event to cutoff, including idle time
Compactions recorded 0 Complete record to cutoff
Models recorded claude-opus-5-5 Session record; no changes
Reasoning levels recorded high One setting at session start; no changes

@github-code-quality

github-code-quality Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage/plugin

main 63002cd cv/label-v1-prs afbb0f2 +/-
96% 97% +1%
View coverage of the 10 most impacted files.
File main 63002cd cv/label-v1-prs afbb0f2 +/-
nemoclaw/src/sh...cy-boundary.cts 100% 97% -3%
nemoclaw/src/onboard/config.ts 98% 96% -2%
nemoclaw/src/ru...time-context.ts 100% 99% -1%
nemoclaw/src/bl...print/runner.ts 95% 95% 0%
nemoclaw/src/bl...ime-identity.ts 97% 97% 0%
nemoclaw/src/bl...t-management.ts 100% 100% 0%
nemoclaw/src/index.ts 94% 99% +5%
nemoclaw/src/de...search-state.ts 0% 100% +100%
nemoclaw/src/on...native-route.ts 0% 100% +100%
nemoclaw/src/search-config.ts 0% 100% +100%

TypeScript / code-coverage/cli

main 63002cd cv/label-v1-prs afbb0f2 +/-
84% 86% +2%
View coverage of the 10 most impacted files.
File main 63002cd cv/label-v1-prs afbb0f2 +/-
src/lib/onboard.ts 62% 50% -12%
src/lib/actions...ess-recovery.ts 65% 83% +18%
src/lib/inferen...ollama/proxy.ts 41% 61% +20%
src/lib/onboard.../application.ts 55% 84% +29%
src/lib/domain/...y/dimensions.ts 0% 75% +75%
src/lib/inferen...er/lifecycle.ts 0% 75% +75%
src/lib/actions...ry/operation.ts 0% 76% +76%
src/lib/actions...try/snapshot.ts 0% 84% +84%
src/lib/inferen...ovider/index.ts 0% 90% +90%
src/lib/hermes-...yard-routing.ts 0% 95% +95%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 20, 2026 05:35 UTC

cv added a commit that referenced this pull request Nov 20, 2026
## 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]>
@cv
cv marked this pull request as ready for review November 20, 2026 05:36
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit afbb0f2. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

Request review only when Require no Advisor blockers is green.

All previous runs

@cv
cv enabled auto-merge (squash) November 20, 2026 07:58
@cv
cv disabled auto-merge November 20, 2026 07:58
@cv
cv merged commit 00ca1b6 into main Nov 20, 2026
83 checks passed
@cv
cv deleted the cv/label-v1-prs branch November 20, 2026 07:58
@github-actions github-actions Bot added the v0.0.146 Release target label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.0.146 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant