Skip to content

fix(cli): make the macOS CLI symlink world-readable and recover unreadable ones - #20813

Closed
nplez1 wants to merge 4 commits into
stablyai:mainfrom
nplez1:fix/cli-symlink-world-readable
Closed

nplez1 wants to merge 4 commits into
stablyai:mainfrom
nplez1:fix/cli-symlink-world-readable

Conversation

@nplez1

@nplez1 nplez1 commented Sep 15, 2026 •

Copy link
Copy Markdown

ELI5

Registering the Orca CLI on macOS can publish /usr/local/bin/orca as a symlink only root may read. Running it still works, but readlink fails, and Orca uses readlink to report install status — so Settings → CLI registration crashes with EACCES. This publishes the link with a readable mode, and makes status survive a link that is already unreadable.

What Changed

  • cli-command-filesystem-transaction.ts creates the published symlink as (umask 022; /bin/ln -s …), so it lands 0755 instead of inheriting the script's umask 077. The subshell keeps 077 in force for the following /bin/ln -P and the rollback paths.
  • cli-command-inspection.ts reports an entry it cannot read as stale with currentTarget: null, rather than rethrowing the EACCES. This applies only once lstat has confirmed a symlink: a regular file Orca cannot read keeps failing, so it is never offered for replacement on evidence nobody inspected.
  • inspectStableCommand returns on a permission error from that symlink read instead of retrying three times and throwing "changed while Orca inspected it". Other errors, and permission errors while hashing a regular file, still retry exactly as before.
  • Tests: the privileged-transaction test asserts the published mode is 0755; cli-command-unreadable-symlink.test.ts covers both recovery paths.

Four files: two source, two tests.

Why

Fixes #19120.

macOS, unlike Linux, enforces a symlink's own permission bits on readlink(2). The transaction runs ln -s under its own umask 077, so the shim was published 0700 and root-owned. The link target was correct, which is why executing it worked while only readlink failed — an asymmetry that surfaces as two unrelated-looking symptoms:

  • Settings throws EACCES: permission denied, readlink '/usr/local/bin/orca'.
  • The PATH command reports Unable to determine Orca.app path from symlink.

Correcting creation alone is not enough for installs that already have the bad link. Inspection has to survive it before the user can reach the re-register action that applies the corrected mode.

Linked Issue

Fixes #19120

Visual Proof

N/A — no UI or interaction change. No .tsx or renderer file is touched; the visible effect is that an existing crash stops.

Testing

  • pnpm typecheck and pnpm build pass (build covers build:cli and the native targets).

  • Full pnpm test: 81,234 passed, 0 failed. One file fails to load locally on untouched main too — tests/e2e/relay-region-correction.unit.test.ts needs the cloud/ workspace's pg, which CI installs.

  • pnpm lint: this diff adds no findings, and oxlint --deny-warnings over src/ and over the changed files exits 0. The full lint still fails on two pre-existing mobile/src/transport cycle warnings in files this branch does not touch.

  • Manual, on installed builds (ls -l /usr/local/bin/orca): lrwx------ on a build registered 2026-09-12, lrwxr-xr-x on a build carrying this fix. Both hosts report a shell umask of 022, so the restrictive umask came from the transaction rather than the shell.

  • cli-command-unreadable-symlink.test.ts injects the EACCES, because the real case needs a root-owned 0700 link that a non-root test cannot create. Reverting either source change makes it fail with the matching symptom, which is how I found that the retry path needed its own fix.

  • Surrounding suites also run: src/main/cli (29 files, 212 tests), src/main/ipc/cli.test.ts, cli-appimage-stale-registration.test.ts, both CliSection suites.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

AI-assisted: GPT-5.6 Luna and DeepSeek v4.1 Flash.

Review

AI code review summary, as CONTRIBUTING requests:

  • Cross-platform: darwin-only by construction (buildMacPrivilegedSymlinkTransaction); no Windows or Linux path, separator, or shortcut is affected.
  • SSH / remote / local: not applicable — host-local CLI registration.
  • Agents / integrations: none.
  • Performance: one umask builtin and one branch; no new I/O.
  • UI quality: no UI change.
  • Security: the transaction writes to a privileged location. This pins the published link's own mode and scopes the umask to a subshell, so the hardlink and rollback paths keep 077. No new privilege, input, or read. The one weakened guard is in Notes.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Trade-off for review: inspectStableCommand returns rawSymlinkTarget: null for an unreadable symlink, and that value feeds the transaction's expectedRawSymlinkTarget check, so a replace proceeds without that guard — it cannot be captured for a target that cannot be read. The snapshot comparison (device, inode, mode, size, ctime) still runs, so a swap between inspection and replacement still aborts. Without this change the whole status call fails and the user can neither see nor repair anything.
  • Reporting stale encourages re-registration, which displaces an existing entry. If that entry were a foreign root-owned link at this path, the transaction quarantines it and reports where the original is preserved.
  • Linux ignores a symlink's own mode, so readlink does not fail there; Windows uses a different install path.
  • No X/Twitter handle, so the Author line CONTRIBUTING mentions is omitted.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@nplez1
nplez1 marked this pull request as ready for review September 15, 2026 08:23
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 48c5b9ef-ab81-4cf9-90f2-8a82d13f4b27

📥 Commits

Reviewing files that changed from the base of the PR and between 9f7f5b399590f6a0df6c8ca7ff7e2ebc7393e4ba and 14881f265c3ef3e3b134472657c64a1f7e7ea404.

📒 Files selected for processing (3)
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/cli-command-unreadable-symlink.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/cli-command-unreadable-symlink.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The macOS privileged transaction applies umask 022 only while creating the published symlink. The transaction test verifies 0755 permissions. Permission recovery now applies only to confirmed symlinks. Unreadable regular files still retry or rethrow. New tests cover stale status and null inspection evidence.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 14881

The CLI registration path preserves the intended permissions and safely distinguishes recoverable stale symlinks from regular-file conflicts. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed For #19120, the PR applies umask 022 only to the published ln -s step. The privileged transaction test verifies 0755 permissions. inspectSymlink reports a confirmed unreadable symlink as stale…
Out of Scope Changes check ✅ Passed The changes are limited to macOS CLI symlink creation, symlink inspection, permission-error handling, and related automated tests. Each change supports the requirements in #19120. No unrelated change …
Title check ✅ Passed The title clearly and concisely describes the two main changes: making the macOS CLI symlink readable and recovering from existing unreadable symlinks.
Description check ✅ Passed The description includes all required template sections, links issue #19120, explains the change and rationale, documents testing and platform impact, and completes the checklist.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Publish the privileged symlink under umask 022 — buildMacPrivilegedSymlinkTransaction now creates the macOS shim inside (umask 022; /bin/ln -s …), so the symlink inode is 0755 and survives the following /bin/ln -P hardlink into the command directory. The subshell keeps that umask out of the hardlink and rollback paths.
  • Pin the published mode in the transaction test — adds expect((await lstat(fixture.commandPath)).mode & 0o777).toBe(0o755).

The fix targets the real cause: the transaction's own umask 077 (cli-command-filesystem-transaction.ts:188), not the caller's shell. The new assertion is genuine — the generated command sets umask 077 before creating the symlink, so a pre-fix run yields 0700 and fails on macOS. The non-privileged symlink() path is user-owned, so owner-read keeps readlink working there; no parallel gap.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nplez1 nplez1 changed the title fix(cli): create the privileged command symlink world-readable fix(cli): make the macOS CLI symlink world-readable and recover unreadable ones Sep 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7e9a2143-2ae0-41bb-8c25-1c49fdbb2749

📥 Commits

Reviewing files that changed from the base of the PR and between 00dcd8c1e35500889783985a390f353d7b1d9c4c and c19cf03d5ee5af68cb6dcec3e4e8d02d751f8d0e.

📒 Files selected for processing (3)
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/cli-command-unreadable-symlink.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/main/cli/cli-command-inspection.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Recover from an unreadable managed symlink — inspectSymlink now catches EACCES/EPERM from readlink/readFile and reports the entry as stale (currentTarget: null, "cannot be read — re-register" detail) instead of rethrowing, so cli:getInstallStatus no longer crashes the Settings pane.
  • Stop treating a permission failure as instability — inspectStableCommand no longer funnels a permission error into the "changed while Orca inspected it" retry loop; it returns the inspection with no target evidence so a privileged replace can still proceed. Non-permission errors still retry exactly as before.
  • New cross-platform test coverage — cli-command-unreadable-symlink.test.ts injects the EACCES on readlink and exercises both getStatus and inspectStableCommand. I ran it against the pre-fix source: both tests fail, reproducing the real EACCES throw and the retry-to-failure error, so the coverage is not theatre.

The author-flagged trade-off — expectedRawSymlinkTarget is null for an entry that was unreadable to begin with, so the replace relies on device/inode identity — is bounded and reasonable. The alternative (failing the entire status call) is strictly worse, and the snapshot identity check still runs.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Scope the unreadable-entry recovery to confirmed symlinks — inspectSymlink records confirmedSymlink from the successful lstat and now converts a permission error into stale only when the failing read was a readlink on a confirmed symlink; an unreadable regular file re-propagates its EACCES instead of being offered for replacement.
  • Match that scoping in the stable-inspection loop — inspectStableCommand derives isSymlinkEntry from the post-inspection snapshot and swallows a permission error only on the symlink readlink branch; a permission error while hashing a regular file retries and fails exactly as before.
  • Cover both recovery paths in tests — cli-command-unreadable-symlink.test.ts is restructured around a makeMacInstaller('symlink' | 'file') helper, adds the unreadable-regular-file rejection case, and is now describe.skipIf(win32) so file-symlink creation does not break the Windows run.
  • Comment tightening — 9f7f5b3995 rewords the Why comments only; no behavioral effect.

The scoping is precise: both flags are only true after lstat confirms a symlink, and on that branch the only operation that can raise a permission error is readlink (no readFile follows it). I ran cli-command-unreadable-symlink.test.ts locally — 3/3 pass; the macOS-gated privileged-transaction suite skips on Linux as designed. This also resolves the two CodeRabbit threads from the prior revision.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The macOS privileged symlink transaction created its link under whatever umask
the installer inherited, so a restrictive umask left an `orca` shim other users
cannot traverse. Pin the link to 022 in a subshell and assert the resulting mode
in the privileged-transaction test.
Pinning the umask stops new installs from publishing an unreadable shim, but an
install that already has one still crashes: macOS enforces a symlink's own mode
on readlink(2), so the status call fails with EACCES before Settings can render
and offer to re-register.

Report such an entry as stale with no target evidence instead of rethrowing, and
stop inspectStableCommand treating an unreadable entry as an unstable one — a
permission error is returned rather than retried three times and thrown as
"changed while Orca inspected it". Other errors retry as before. An unreadable
target cannot be guarded by expectedRawSymlinkTarget either way, so the snapshot
comparison remains the guard there.
Recovering every permission error in inspectSymlink also caught a regular file
whose contents could not be read, and reported it as stale — so an unreadable
file could be replaced instead of preserved as a conflict. Gate the recovery on
lstat having confirmed a symlink, and suppress the error in inspectStableCommand
only for that symlink read rather than the file-hash branch.

Adds the regression test for the regular-file case, which reports stale without
this gate, and skips these symlink fixtures on Windows, where creating a file
symlink may need Developer Mode.
@nplez1
nplez1 force-pushed the fix/cli-symlink-world-readable branch from 14881f2 to 60a2c09 Compare September 17, 2026 06:55
nplez1 added a commit to nplez1/orca that referenced this pull request Sep 22, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
nplez1 added a commit to nplez1/orca that referenced this pull request Sep 25, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
nplez1 added a commit to nplez1/orca that referenced this pull request Sep 27, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
nplez1 added a commit to nplez1/orca that referenced this pull request Sep 29, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 1, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 6, 2026
Sync log entry for the rebase: 95 commits replayed, 87 byte-identical and 8 adapted by
range-diff, none dropped, plus the two fix-up commits the gates forced; the four
conflicting commits across eight files; and the two traps that fired with no conflict
marker — three clean-merge renames only `pnpm tc` could see, and a computer-use test
whose way of faking an unreadable plist stopped reaching the code when upstream moved
the bundle-id read onto the shared spawn chokepoint.

Also records the two deliberate divergences: the explorer hook converged onto upstream's
request-key listing model, which folds our `totalCount`/`ignoredFiles` into it and drops
our `resolvedQuery` fence and one upstream test whose premise #20 replaced; and the
sidebar status filter re-seated into upstream's new `visible-worktree-options-from-state.ts`.

BRANCHES.md takes the new base, the re-measured drift (436 and 530 commits behind), and
notes that stablyai#20813 is open on a pre-sync base.
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @nplez1 for working on both the published link permissions and handling unreadable existing links, and for adding regression coverage.

We've merged the team's fix for #19120 in #29245, which covers these cases. Closing this PR as superseded. We appreciate the investigation and testing you put into it.

nplez1 added a commit to nplez1/orca that referenced this pull request Oct 24, 2026
…c-log size

Four pieces of process surface that disagreed with the tooling or with itself:

- § "Syncing with upstream" ran `git rebase origin/main`, while the runbook and
  every sync actually recorded here merge `upstream/main` into the release line.
  Rebase is for a feature branch or the patch series, and the merge commits are
  load-bearing (rollback tags, one hand-resolved merge whose resolutions exist
  nowhere else). The section now says merge, and says why.
- The pre-sync-tip diff wrote fixed `/tmp/modified.txt` and
  `/tmp/upstream-changed.txt`, and `local/open-pr.mjs` documented
  `--body-file /tmp/body.md`. That is exactly the collision two agents already had
  on a body file; both are `mktemp` now, and a test holds the fenced commands to it.
- `.husky/commit-msg` said PR branches are cut from `origin/main`, contradicting
  AGENTS.md: fork PR branches are cut from `nplez1/main` and only upstream-bound
  ones from `origin/main`.
- The sync log was ~1,980 lines of 26 entries, which is the size at which a section
  stops being read. The three most recent entries stay inline and the other 23 moved
  verbatim to `local/sync/sync-log-archive.md`, with a policy line rather than a
  habit: `tests/tools/fork-process-docs.test.mjs` fails if more than three are left
  inline.

BRANCHES.md also records what the fixed `branch-status.mjs` now reports: the
inventory is derived from the refs, PR state comes from both repos, and PR stablyai#20813
was closed upstream on 2026-10-16 rather than awaiting a human.
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 24, 2026
* fix(fork): derive the branch-status table from the refs it reports on

`local/branch-status.mjs` is named in AGENTS.md and BRANCHES.md as the source of
truth for branch state, and it was a hardcoded table its own header warns against:
none of the live `nplez1/*` branches appeared, twelve of the fourteen listed ones
existed nowhere, the default parent `origin/main` failed to resolve (origin's
refspec maps only `refs/heads/nplez1/*`), so every "own delta" printed `0 file(s)`,
`PARENTS['feat/terminal-session-reconnect']` never matched the branch that exists
under `fix/`, and PR state was queried only on `stablyai/orca`.

The inventory is now derived from `refs/heads/nplez1`, `origin/nplez1/*` and the
fork's own heads (`git ls-remote --heads origin`, one call), so a branch that
exists is reported and a deleted one cannot linger. The one named list left is the
upstream-bound set, which no ref here describes, and a name in it that matches no
ref is reported instead of ignored. The default parent is `nplez1/main`, a
non-fork branch is measured against `upstream/main`, and a parent that does not
resolve prints `parent <ref> MISSING` rather than a silent zero. PR state comes
from the fork in one bulk query and from upstream per upstream-bound branch.

`--local-only` keeps it usable offline, and the branch list, the parent keys and
the two PR sources are covered by `tests/tools/branch-status.test.mjs`, including
a real temp repo for the derivation and the delta.

* feat(fork): validate an upstream PR against upstream, and enforce both PR gates

Three defects in one file, all of them the same shape: a check that reported
something other than what it read.

`--upstream` targeted `stablyai/orca` but fetched and validated the base against
`origin`, whose `main` is a different commit and whose refspec does not even map
`refs/heads/main`, so the ref never resolved and `merge-base --is-ancestor` failed
with "is not a descendant" — a wrong-remote bug diagnosed as a wrong-base one. The
base is now resolved against the remote the PR targets, and an unresolvable base is
reported as such. The naive repair is the hazard: `origin/main` *is* an ancestor of
`nplez1/main`, so once the ref resolves any branch cut from the fork line would
pass and carry all of the `local(...)` series upstream. An upstream head is now
refused outright if its `base..head` range contains one.

Both PR gates were advisory — recorded in AGENTS.md, read by nothing. Gate 1 now
requires a cached unit-gate PASS for the exact head revision, and gate 2 a review
claim line naming a round and a verdict. The verdict cache moved into
`local/gate-verdict-cache.mjs` so `gate-unit.mjs` (which writes it) and this script
(which reads it) cannot drift apart. `--waive-gate <1|2>:<reason>` records a
deliberate exception and prints it for the PR body; an upstream PR skips gate 1,
because upstream CI is the gate there.

Covered by `tests/tools/open-pr.test.mjs`: the two targets and their remotes, the
waiver parsing, the review-claim rules (including the markdown emphasis a body
usually wraps it in), fork-only commit detection, and every gate-1 refusal path.

* docs(fork): correct the release-line sync, the /tmp names and the sync-log size

Four pieces of process surface that disagreed with the tooling or with itself:

- § "Syncing with upstream" ran `git rebase origin/main`, while the runbook and
  every sync actually recorded here merge `upstream/main` into the release line.
  Rebase is for a feature branch or the patch series, and the merge commits are
  load-bearing (rollback tags, one hand-resolved merge whose resolutions exist
  nowhere else). The section now says merge, and says why.
- The pre-sync-tip diff wrote fixed `/tmp/modified.txt` and
  `/tmp/upstream-changed.txt`, and `local/open-pr.mjs` documented
  `--body-file /tmp/body.md`. That is exactly the collision two agents already had
  on a body file; both are `mktemp` now, and a test holds the fenced commands to it.
- `.husky/commit-msg` said PR branches are cut from `origin/main`, contradicting
  AGENTS.md: fork PR branches are cut from `nplez1/main` and only upstream-bound
  ones from `origin/main`.
- The sync log was ~1,980 lines of 26 entries, which is the size at which a section
  stops being read. The three most recent entries stay inline and the other 23 moved
  verbatim to `local/sync/sync-log-archive.md`, with a policy line rather than a
  habit: `tests/tools/fork-process-docs.test.mjs` fails if more than three are left
  inline.

BRANCHES.md also records what the fixed `branch-status.mjs` now reports: the
inventory is derived from the refs, PR state comes from both repos, and PR stablyai#20813
was closed upstream on 2026-10-16 rather than awaiting a human.
@nplez1
nplez1 deleted the fix/cli-symlink-world-readable branch October 27, 2026 13:56
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.

[Bug]: macOS CLI registration creates a 0700 /usr/local/bin/orca symlink; Settings crashes with EACCES on readlink

2 participants