Skip to content

docs(pi): a bundled host must resolve pi-ai once - #387

Merged
xxchan merged 1 commit into
mainfrom
docs/pi-single-copy
Oct 13, 2026
Merged

xxchan merged 1 commit into
mainfrom
docs/pi-single-copy

Conversation

@xxchan

@xxchan xxchan commented Oct 13, 2026

Copy link
Copy Markdown
Member

Part of #386. docs/runtimes/pi.md now says that OAR's hand-over of pi's sign-in flows and Bedrock only works when a bundled host's bundle holds one copy of pi-ai. Two peer variants of the same pi-ai version put the hand-over on the copy no session uses, and every OAuth turn fails with "Cannot find module" again. OAR cannot reach pi-coding-agent's copy, because pi-coding-agent exports only . and ./rpc-entry (earendil-works/pi#10458 was declined). So the host pins pi's optional peers or uses an override, and checks its bundle names one @earendil-works+pi-ai@ variant. Docs only, so no CI and no release.

🤖 Generated with Claude Code

@xxchan
xxchan merged commit 425e5a7 into main Oct 13, 2026
@xxchan
xxchan deleted the docs/pi-single-copy branch October 13, 2026 11:47
xxchan added a commit that referenced this pull request Oct 13, 2026
Corrects #387 for #386. Raft's daemon fix confirmed that the two pi-ai
copies differ by how `undici` resolves, an optional peer of pi-ai's
`openai` dependency: the daemon depended on `undici` 7, while
pi-coding-agent (and OAR) pin 8.10.2. earendil-works/pi#10458 reports
the same split from `discord.js` pinning `undici` 6. My earlier text
blamed the AWS credential-provider group. The page now names `undici`
first, and gives the host-side fix: pin `undici` and the other `openai`
peers to pi-coding-agent's versions, check for a single
`@earendil-works+pi-ai@` variant, and keep a build check that derives
auth for a dummy OAuth credential through pi-coding-agent's own
`ModelRuntime`. Docs only, so no CI and no release.

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

Co-authored-by: exe.dev user <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@xxchan xxchan mentioned this pull request Oct 13, 2026
xxchan added a commit that referenced this pull request Oct 13, 2026
Release OAR and CLI 0.62.1. This PR changes only the two package version
fields.

**Fixed: pi's proxy plane connects the way pi does** (#389)
- When pi's settings or the environment name a proxy (or set a
non-default idle timeout), OAR installs an undici `EnvHttpProxyAgent` as
the process-global dispatcher for an embedded pi.
- It now carries the connection options pi's own dispatcher sets
(pi-coding-agent 1.2.0 `core/http-dispatcher.js`):
  - `allowH2: false`;
  - `proxyTunnel: true`;
  - a 2 s address-family attempt timeout.
- Before this, undici 8 could negotiate HTTP/2 and send http targets to
a proxy without a CONNECT tunnel. An embedded pi connected differently
from `pi` itself, and so did every global `fetch` in the host, because
the dispatcher is process-global.
- A test reads pi's own file, so a change in pi shows up.
- A dispatcher the host set itself is still never replaced.

**Docs** (#387, #388)
- `docs/runtimes/pi.md` says a bundled host must keep one copy of pi-ai,
and why: an `undici` that differs from pi-coding-agent's pin splits it.
It also says how to check a bundle (#386).

**Behavior changes**
- Only when the plane is installed: HTTP/1.1 instead of possibly HTTP/2,
and CONNECT tunnels for http targets behind a proxy, as `pi` does.

Validation: #389 passed all 17 checks on its final head, and its merged
tree equals its CI tree. Typecheck, lint, the unit suite (1782 tests)
and the pi-aimock vendor suite (38) pass. The proxy tests now go through
a stand-in that answers CONNECT. After this PR passes CI and merges, tag
its exact squash commit as `v0.62.1` to trigger npm trusted publishing.

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

Co-authored-by: exe.dev user <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 20, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/ZXll.svg"
width="16" height="16" align="absmiddle" alt=""> <b>Lookout</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_78d6154b7fa5b739f485cde40249b6e1"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

## Summary

Add a workflow-level `concurrency` group per ref with
`cancel-in-progress: true` to `.github/workflows/ci.yml` (`#core:#387`):

```yaml
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
```

## Why

On `main`, each push schedules ~15 macOS jobs. Without workflow-level
concurrency cancellation, successive merges queue superseded `main` runs
ahead of the release commit's run, starving the macOS runner pool until
`release.yml`'s 60-minute CI gate times out. `main` has now had to be
unblocked by hand three times:
- `0.122.0` on 2026-11-19
- `0.125.0` on 2026-11-20 at 06:02 UTC (9 queued runs, `#378`)
- `0.126.0` on 2026-11-20 at 18:50 UTC (5 older queued runs)

With `group: ${{ github.workflow }}-${{ github.ref }}` and
`cancel-in-progress: true`:
- `push` to `main` and `workflow_dispatch` on `main` share
`ci-refs/heads/main`, so newer `main` pushes and manual recovery
dispatches cancel older queued/running `main` runs immediately.
- Each pull request uses `ci-refs/pull/<N>/merge`, so pushes to a PR
cancel only older runs on that same PR and never collide with `main`,
other PRs, or a `workflow_dispatch` on the branch ref
(`ci-refs/heads/<branch>`).

## Dependency Audit (verified before changing)

- **`.github/workflows/release.yml` (untouched):** Lines 79-80 query
only `actions/workflows/ci.yml/runs?head_sha=$GITHUB_SHA`, selecting
`.event == "push" or .event == "workflow_dispatch"` and taking `first`
(newest run for that exact commit). It never reads older commits' runs.
If another commit merges to `main` while a release commit's CI is
running, the superseded commit's run is cancelled and `release.yml`
fails closed (`CI did not succeed on $GITHUB_SHA`), matching its
contract that a dispatched release is only ever the current head of
`main`.
- **Other workflows in `.github/workflows/`:** None use `workflow_run`
on `ci.yml` or depend on older `ci.yml` runs. `osv-scanner.yml`,
`runtime-latest.yml`, and `release.yml` already declare workflow-level
`concurrency`.
- **Stamp (`stamp settings -R botiverse/oar`, `stamp repo guard list -R
botiverse/oar`):** `merge_hold` has no active holds (`holds: []`),
`ci_on_ready` has no custom rules, and `workflow_guard` is off. Verified
empirically on the 5 cancelled `main` runs from 2026-11-20
(`44738501140`, `44751339691`, `44758089023`, `44770042974`,
`44777833935`): Stamp posted zero false post-merge failure comments on
their PRs (`#1084`, `#1085`).

## Verification

- Validated `.github/workflows/ci.yml` YAML parsing.
- `CI=1 pnpm run check` passes locally (typecheck, `oxlint --type-aware
--deny-warnings`, unit tests, mock `sea-trial`).

Co-authored-by: Lookout <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 20, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/ZXll.svg"
width="16" height="16" align="absmiddle" alt=""> <b>Lookout</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_d326ec9e59a8265a6ee34e5c43a7f85f"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

## Summary

Follow-up to `#1091` (`#core:#387`): require the `workflow_dispatch`
release gate in `.github/workflows/release.yml` to verify that
`$GITHUB_SHA` is the merge commit of the matching merged `chore: release
$TAG` PR on `main`, reusing `release_only`'s exact PR-matching filter so
the rule lives in one place.

## Why

With per-ref CI cancellation on `main` (`#1091`), a commit merged after
a release PR cancels that release commit's CI. Re-dispatching
`release.yml` from `main` without checking the commit's PR would run
against the new head of `main` and publish it with the non-release PR's
notes.

## Changes

- **`.github/workflows/release.yml`** (gate and shared filter only;
publish steps and `release` job untouched):
- Hoisted `release_only`'s exact `jq` PR-matching rule into
workflow-level `env.RELEASE_PR_FILTER` (keeps `release_only` free of
`actions/checkout` and untrusted code).
- Added `pull-requests: read` to `publish.permissions` so the gate can
read `repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls`.
- Updated `publish`'s `gate a dispatched release on main's CI` step to
evaluate `$RELEASE_PR_FILTER` against `$GITHUB_SHA` before entering the
60-minute CI poll loop, failing closed on any non-release, unmerged,
wrong-commit, or ambiguous PR.
  - Updated `release_only` to reference `"$RELEASE_PR_FILTER"` directly.
- **`tests/release-only-workflow.test.ts` and
`tests/fixtures/release-only-cli.ts`**:
- Execute the actual `gate a dispatched release on main's CI` bash step
extracted from `.github/workflows/release.yml` with `RELEASE_PR_FILTER`
read from the workflow.
- Verify the gate accepts a matching merged `chore: release $TAG` PR and
refuses non-release PRs, wrong commits, unmerged/ambiguous PRs, null
notes, API failures, and existing tags before polling `ci.yml/runs`.
- Verify `publish` declares `pull-requests: read` and both steps
reference `"$RELEASE_PR_FILTER"`.

## Verification

- Validated `.github/workflows/release.yml` YAML parsing.
- `CI=1 pnpm run check` passes locally (typecheck, `oxlint --type-aware
--deny-warnings`, unit tests including all 27 cases in
`tests/release-only-workflow.test.ts`, mock `sea-trial`).

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant