Fix pinned Codex package discovery and final review gates
Allow pinned Codex package sources while preserving protected-home and hash checks. Correct timeout docs and apply Paul's dated copy acceptance markers. Fix the historical fake-token scan and stale inventory assertion. Explicitly unlock account homes before closing descriptors to prevent fork-related lock retention; deterministic regressions cover both cleanup paths. Verification: ten deliberate guard mutations were caught. The first full make -k ci exited 2 for the fixture scan, inventory assertion, and account lock failure. After corrections, the second full make -k ci exited 0 on tree ae2aa13b0dcfe0c2037d77342d8603dfc9a896cc. All required gates passed, including uncached tests, adapter and namespace checks, migrations and perf. No live gate, real sign-in, deployment, or copy-review server was run.
Co-Authored-By: Astra <noreply@openai.com>
15 files changed,
+521
−119
.gitleaks.toml+5 −0docs/live-gate.md+5 −4docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+54 −54docs/superpowers/plans/CONTROLLER-REPORT-try-equipo-4.md+117 −0internal/equipo/copy.go+53 −53internal/plan3test/plan3_release_test.go+3 −2internal/runner/provider/accounts.go+4 −1internal/runner/provider/accounts_test.go+15 −0internal/tryequipo/accounts.go+7 −1internal/tryequipo/executable.go+45 −3internal/tryequipo/executable_test.go+154 −0internal/tryequipo/home_lock_test.go+36 −0internal/tryequipo/prerequisites.go+1 −1internal/tryequipo/review_fixes_test.go+1 −0scripts/runner-reference-allowlist.json+21 −0
CI passed — run details
diff --git a/.gitleaks.toml b/.gitleaks.toml| index d8e2a1b9..d5e5feee 100644 |
| --- a/.gitleaks.toml |
| +++ b/.gitleaks.toml |
| @@ -7,3 +7,8 @@ useDefault = true |
| description = "Plan 3 integration fixtures use the literal instance key plan3-fixture for offline test apps; it is not a credential." |
| regexTarget = "line" |
| regexes = ['''InstanceKey:\s*"plan3-fixture"'''] |
| + |
| +[[allowlists]] |
| +description = "Offline expiry tests use this unsigned fake token with exp=1; it is not a credential." |
| +regexTarget = "secret" |
| +regexes = ['''^e30\.eyJleHAiOjF9\.sig$'''] |
diff --git a/docs/live-gate.md b/docs/live-gate.md| index 083a4134..1c09d6c4 100644 |
| --- a/docs/live-gate.md |
| +++ b/docs/live-gate.md |
| @@ -1,6 +1,6 @@ |
| # Try Equipo |
| -Draft changes pending copy review. |
| +COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context). |
| On docs-t1, run this as yourself from the reviewed checkout: |
| @@ -69,9 +69,10 @@ If the run stops, run the same script again. Confirmed accounts and setup values |
| are retained under `~/.local/share/equipo/try/`. Each certification attempt gets |
| a fresh evidence directory and log; incomplete evidence is never reused as a |
| passing result. After proving the prior controller has stopped, it removes |
| -interrupted account-change scratch. The gate log includes test stderr, and the |
| -calibration duration controls the timeout. The guide refuses to overwrite |
| -configuration it did not create. |
| +interrupted account-change scratch. The gate log includes test stderr. The guide |
| +passes `-timeout=0` to disable the Go test timeout; the live driver enforces the |
| +calibration duration. The guide refuses to overwrite configuration it did not |
| +create. |
| On success, the guide prints the manifest candidate and the controller's release |
| command. The controller reviews the sanitized evidence, imports the bundle at |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index d9a594e0..8e81f729 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -5099,60 +5099,60 @@ records to satisfy a gate. Release remains blocked while any row is pending. |
| | `docs/mockups/onboarding.html / paired without account` | Waiting for a model account. | 16 | Proposal only; COPY REVIEW REQUIRED | |
| | `plan.awaiting_approval` | Waiting for your plan approval | Final review fix wave | COPY REVIEW REQUIRED | |
| -| `connections.empty` | Connections are not available yet. | Guided live gate or expired connection | COPY REVIEW REQUIRED | |
| -| `account.sign_in_again` | Sign in again | Guided live gate or expired connection | COPY REVIEW REQUIRED | |
| -| `prerequisite` | Missing prerequisite: %s. Install the pinned version outside interactive homes and run the guide again.<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `prompt` | %s [%s]: | Guided live gate | COPY REVIEW REQUIRED | |
| -| `confirm` | Observed account for %s: %s. Confirm this account? [yes/no]: | Guided live gate | COPY REVIEW REQUIRED | |
| -| `login` | Signing in to %s in its dedicated home. Follow the official CLI instructions in this terminal.<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `failed` | Stopped at %s: %v. Correct the cause above. Saved setup can be resumed by running scripts/try-equipo.sh again. No release was made.<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `ready` | Manifest candidate: %s<br>After reviewing and importing the evidence bundle and candidate manifest, the controller releases with:<br>%s<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `live` | Type RUN LIVE GATE to authorize the displayed limits and disposable exercises | Guided live gate | COPY REVIEW REQUIRED | |
| -| `signin` | Type SIGN IN to start official sign-ins in dedicated homes | Guided live gate | COPY REVIEW REQUIRED | |
| -| `claude-accounts` | Total Claude accounts to connect | Guided live gate | COPY REVIEW REQUIRED | |
| -| `codex-accounts` | Total Codex accounts to connect | Guided live gate | COPY REVIEW REQUIRED | |
| -| `account-minimum` | Enter a whole number of at least %d. Keep all confirmed accounts connected. Lower the count to drop an unconfirmed account.<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `duplicate-account` | This account is already connected in another home. Run the guide again and sign in to a different account.<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `instance` | Instance ID from Equipo | Guided live gate | COPY REVIEW REQUIRED | |
| -| `person` | Your Equipo person ID | Guided live gate | COPY REVIEW REQUIRED | |
| -| `claude-model` | Exact Claude model | Guided live gate | COPY REVIEW REQUIRED | |
| -| `codex-model` | Exact Codex model | Guided live gate | COPY REVIEW REQUIRED | |
| -| `forge` | Absolute path to the runner's Amadan credential file | Guided live gate | COPY REVIEW REQUIRED | |
| -| `Calls` | Maximum calibration calls | Guided live gate | COPY REVIEW REQUIRED | |
| -| `InputTokens` | Maximum calibration input tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `OutputTokens` | Maximum calibration output tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `Seconds` | Maximum calibration seconds | Guided live gate | COPY REVIEW REQUIRED | |
| -| `JobInput` | Job input token funding | Guided live gate | COPY REVIEW REQUIRED | |
| -| `JobOutput` | Job output token funding | Guided live gate | COPY REVIEW REQUIRED | |
| -| `ProjectInputHeadroom` | Remaining project input tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `ProjectOutputHeadroom` | Remaining project output tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `TeamInputHeadroom` | Remaining team input tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `TeamOutputHeadroom` | Remaining team output tokens | Guided live gate | COPY REVIEW REQUIRED | |
| -| `limits` | Authorized limits: %s<br> | Guided live gate | COPY REVIEW REQUIRED | |
| - |
| -| `login-failed` | The official sign-in did not finish. Follow its terminal instructions and run the guide again | Guided live gate | COPY REVIEW REQUIRED | |
| -| `confirmation-required` | The account was not confirmed. Run the guide again to confirm it or lower the account count to drop it | Guided live gate | COPY REVIEW REQUIRED | |
| -| `identity-mismatch` | The observed account does not match the confirmed identity. Sign in to the confirmed account in this dedicated home and retry | Guided live gate | COPY REVIEW REQUIRED | |
| -| `account-check` | Account validation failed. Check this dedicated home and sign in again through the guide | Guided live gate | COPY REVIEW REQUIRED | |
| -| `prerequisite-cause` | Cannot use %s: %v<br> | Guided live gate | COPY REVIEW REQUIRED | |
| -| `executable-hash` | Executable does not match its pinned hash. Install the pinned version and retry | Guided live gate | COPY REVIEW REQUIRED | |
| -| `executable-file` | Executable is not a runnable regular file. Correct its EQUIPO path or permissions | Guided live gate | COPY REVIEW REQUIRED | |
| -| `executable-home` | Executable is inside an interactive or ZeroSub home. Install the pinned CLI outside those homes and set its EQUIPO path | Guided live gate | COPY REVIEW REQUIRED | |
| -| `funding-invalid` | Funding limits must be positive whole numbers and seconds must be at most 86400. Enter valid limits on the next run | Guided live gate | COPY REVIEW REQUIRED | |
| -| `forge-path` | The Amadan credential must be an absolute path to a regular file with mode 0600. Correct its path or permissions | Guided live gate | COPY REVIEW REQUIRED | |
| -| `live-required` | The live gate was not authorized. Run the guide again and type RUN LIVE GATE to continue | Guided live gate | COPY REVIEW REQUIRED | |
| -| `signin-required` | Sign-in was not authorized. Run the guide again and type SIGN IN to continue | Guided live gate | COPY REVIEW REQUIRED | |
| -| `root-user` | Root cannot run this guide. Run it as your own user | Guided live gate | COPY REVIEW REQUIRED | |
| -| `system-home` | The system home could not be found. Check your operating system account before retrying | Guided live gate | COPY REVIEW REQUIRED | |
| -| `terminal` | No terminal is available. Run the guide from an interactive terminal | Guided live gate | COPY REVIEW REQUIRED | |
| -| `config-value` | A configuration value contains unsupported shell characters. Correct that value and retry | Guided live gate | COPY REVIEW REQUIRED | |
| -| `foreign-file` | A generated file was changed outside the guide. Preserve that change and restore the generated file before retrying | Guided live gate | COPY REVIEW REQUIRED | |
| -| `input-required` | No valid answer was read. Run the guide from a terminal and answer the displayed question | Guided live gate | COPY REVIEW REQUIRED | |
| -| `saved-state` | Saved setup is invalid. Check state.json in the try folder before retrying | Guided live gate | COPY REVIEW REQUIRED | |
| -| `private-file` | Setup needs a regular file with mode 0600. Correct the file permissions and retry | Guided live gate | COPY REVIEW REQUIRED | |
| -| `private-directory` | Setup needs an absolute, unlinked directory with mode 0700. Correct the path or permissions and retry | Guided live gate | COPY REVIEW REQUIRED | |
| -| `go-required` | Missing prerequisite: Go. Install Go and run scripts/try-equipo.sh again. | Guided live gate | COPY REVIEW REQUIRED | |
| -| `guide-busy` | Another guide holds the setup lock. Wait for it to finish before retrying | Guided live gate | COPY REVIEW REQUIRED | |
| +| `connections.empty` | Connections are not available yet. | Guided live gate or expired connection | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `account.sign_in_again` | Sign in again | Guided live gate or expired connection | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `prerequisite` | Missing prerequisite: %s. Install the pinned version outside interactive homes and run the guide again.<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `prompt` | %s [%s]: | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `confirm` | Observed account for %s: %s. Confirm this account? [yes/no]: | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `login` | Signing in to %s in its dedicated home. Follow the official CLI instructions in this terminal.<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `failed` | Stopped at %s: %v. Correct the cause above. Saved setup can be resumed by running scripts/try-equipo.sh again. No release was made.<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `ready` | Manifest candidate: %s<br>After reviewing and importing the evidence bundle and candidate manifest, the controller releases with:<br>%s<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `live` | Type RUN LIVE GATE to authorize the displayed limits and disposable exercises | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `signin` | Type SIGN IN to start official sign-ins in dedicated homes | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `claude-accounts` | Total Claude accounts to connect | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `codex-accounts` | Total Codex accounts to connect | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `account-minimum` | Enter a whole number of at least %d. Keep all confirmed accounts connected. Lower the count to drop an unconfirmed account.<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `duplicate-account` | This account is already connected in another home. Run the guide again and sign in to a different account.<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `instance` | Instance ID from Equipo | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `person` | Your Equipo person ID | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `claude-model` | Exact Claude model | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `codex-model` | Exact Codex model | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `forge` | Absolute path to the runner's Amadan credential file | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `Calls` | Maximum calibration calls | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `InputTokens` | Maximum calibration input tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `OutputTokens` | Maximum calibration output tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `Seconds` | Maximum calibration seconds | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `JobInput` | Job input token funding | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `JobOutput` | Job output token funding | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `ProjectInputHeadroom` | Remaining project input tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `ProjectOutputHeadroom` | Remaining project output tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `TeamInputHeadroom` | Remaining team input tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `TeamOutputHeadroom` | Remaining team output tokens | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `limits` | Authorized limits: %s<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| + |
| +| `login-failed` | The official sign-in did not finish. Follow its terminal instructions and run the guide again | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `confirmation-required` | The account was not confirmed. Run the guide again to confirm it or lower the account count to drop it | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `identity-mismatch` | The observed account does not match the confirmed identity. Sign in to the confirmed account in this dedicated home and retry | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `account-check` | Account validation failed. Check this dedicated home and sign in again through the guide | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `prerequisite-cause` | Cannot use %s: %v<br> | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `executable-hash` | Executable does not match its pinned hash. Install the pinned version and retry | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `executable-file` | Executable is not a runnable regular file. Correct its EQUIPO path or permissions | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `executable-home` | Executable is inside an interactive or ZeroSub home. Install the pinned CLI outside those homes and set its EQUIPO path | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `funding-invalid` | Funding limits must be positive whole numbers and seconds must be at most 86400. Enter valid limits on the next run | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `forge-path` | The Amadan credential must be an absolute path to a regular file with mode 0600. Correct its path or permissions | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `live-required` | The live gate was not authorized. Run the guide again and type RUN LIVE GATE to continue | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `signin-required` | Sign-in was not authorized. Run the guide again and type SIGN IN to continue | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `root-user` | Root cannot run this guide. Run it as your own user | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `system-home` | The system home could not be found. Check your operating system account before retrying | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `terminal` | No terminal is available. Run the guide from an interactive terminal | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `config-value` | A configuration value contains unsupported shell characters. Correct that value and retry | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `foreign-file` | A generated file was changed outside the guide. Preserve that change and restore the generated file before retrying | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `input-required` | No valid answer was read. Run the guide from a terminal and answer the displayed question | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `saved-state` | Saved setup is invalid. Check state.json in the try folder before retrying | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `private-file` | Setup needs a regular file with mode 0600. Correct the file permissions and retry | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `private-directory` | Setup needs an absolute, unlinked directory with mode 0700. Correct the path or permissions and retry | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `go-required` | Missing prerequisite: Go. Install Go and run scripts/try-equipo.sh again. | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `guide-busy` | Another guide holds the setup lock. Wait for it to finish before retrying | Guided live gate | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| ## Task 21 |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-try-equipo-4.md b/docs/superpowers/plans/CONTROLLER-REPORT-try-equipo-4.md| new file mode 100644 |
| index 00000000..af142ec2 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-try-equipo-4.md |
| @@ -0,0 +1,117 @@ |
| +# Controller report: try-equipo re-check fixes |
| + |
| +Brief: CODEX-BRIEF-try-equipo-4.md. Work continues on try-equipo from |
| +`d754720`, which adds the brief after `a7a507c`. |
| + |
| +## Changes |
| + |
| +R1: Codex and its sibling code-mode host may be sourced from the packages |
| +subdirectory of the system Codex home or CODEX_HOME. Both the submitted and |
| +resolved source paths are checked. The exception preserves other interactive |
| +home restrictions and the ZeroSub restriction, including overlapping homes. |
| +Other tools do not receive the exception. The bytes must match their pin before |
| +a private independent copy is written. Copy destinations receive the original |
| +home restrictions without the packages exception. EQUIPO_CODEX_PATH still |
| +selects the source, and the host still comes from beside the resolved Codex. |
| + |
| +R2: docs/live-gate.md now says that the guide disables the Go test timeout with |
| +`-timeout=0`; the live driver enforces the calibration duration. |
| + |
| +R3: Each new runtime marker and the matching guided-setup inventory rows use |
| +Paul's exact 2026-11-04 acceptance marker. The guide carries the equivalent |
| +document marker. Runtime string values are unchanged. Historical reports and |
| +older inventory rows retain their original status. No existing reference hash |
| +changed; three exact allowances were added for the new ZeroSub test fixtures. |
| +The separate release copy check still rejects older pending Plan 3 inventory |
| +rows, as it did at the starting revision. That check is outside this brief's |
| +full CI gate; this work does not certify a release. |
| + |
| +## Verification |
| + |
| +All commands use CGO_ENABLED=0 and the default Go caches. New fixtures use |
| +`t.TempDir()` and do not read or require TMPDIR. |
| + |
| +- Before implementation: `go test ./internal/tryequipo -run '^TestReviewPrivateExecutables$' -count=1` |
| + exited 1. Matching packages, outside symlinks, and configured sibling discovery |
| + were refused by the original implementation. |
| +- After implementation: `go test ./internal/tryequipo -run '^TestReview(PrivateExecutables|CodexSiblingHost)$' -count=1` |
| + exited 0. |
| +- `go test ./internal/tryequipo -count=1` initially exited 0 in 4.319s. |
| + A later run exited 1 in TestUpgradeOriginalThreeHomes with |
| + provider_account_busy. The isolated rerun below passed; no unrelated login |
| + behavior was changed. |
| +- `go test ./internal/tryequipo -run '^Test(UpgradeOriginalThreeHomes|ReviewPrivateExecutables|ReviewCodexSiblingHost)$' -count=1` |
| + exited 0 in 1.610s, including the final default-home coverage. |
| +- `python3 scripts/runner-dead-references.py` exited 0 after the new test |
| + references were inventoried. |
| + |
| +Each mutation below ran through a Go overlay, leaving the working source |
| +unchanged. The command for each row was: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test -overlay=<scratch>/<mutation>.json ./internal/tryequipo -run '^TestReviewPrivateExecutables$/packages/<case>' -count=1 |
| +``` |
| + |
| +| Mutation | Case | Observed result | |
| +| --- | --- | --- | |
| +| deny-packages | matching | Exit 1: matching package source refused | |
| +| allow-other-home | non-packages | Exit 1: forbidden executable copied | |
| +| skip-hash | wrong-hash | Exit 1: wrong hash copied | |
| +| allow-destination | destination | Exit 1: all four protected destinations accepted | |
| +| skip-real-path | symlink-escape | Exit 1: package symlink escaped to config | |
| +| skip-lexical-path | symlink-from-config | Exit 1: config alias accepted | |
| +| allow-unpinned-tool | unpinned-tool | Exit 1: unhashed tool accepted from packages | |
| +| allow-prefix | packages-prefix | Exit 1: sibling directory mistaken for packages | |
| + |
| +The first isolated symlink mutation runs exposed shared fixture setup between |
| +subtests. Each symlink case now creates its own target and parent directory. |
| +Both isolated cases passed without mutation, then failed at their intended |
| +security assertions with the relevant guard removed. |
| + |
| +## Corrections required by the first full gate |
| + |
| +The first `make -k ci` completed with exit 2. Gitleaks reported two historical |
| +occurrences of the same unsigned expired-token fixture in `a7a507c`. Its exact |
| +value is now allowed in .gitleaks.toml; no rule, file, or directory is exempted. |
| +The isolated scan then exited 0 with no findings. |
| + |
| +The full test step ran 25 packages uncached in 5m1.535s and failed two packages: |
| + |
| +- TestPlan3ReleaseBoundaries/inventory still required every entry to be pending. |
| + It now also accepts Paul's exact dated marker for the guided-setup rows. |
| + Other rows keep the previous requirement. The isolated inventory test passed. |
| +- TestAccountResumeAndMismatch failed with provider_account_busy. A duplicate |
| + descriptor can retain a flock after its owner's descriptor closes, including |
| + the interval between a concurrent fork and exec. Deterministic regressions |
| + reproduced this for both AccountLease.Close and the guide's home-lock cleanup. |
| + Both now explicitly unlock before closing. The existing concurrent-lease |
| + refusal remains tested. A run with only the lease correction still failed |
| + during an unconfirmed-account retry; after both corrections, |
| + `go test ./internal/tryequipo -count=3` passed in 12.366s. |
| + |
| +Build, vet, formatting, static analysis, vulnerability checks, size budgets, |
| +adapter checks, namespace checks, migrations and performance passed in the |
| +first full run. No reachable vulnerability was found. Cold boot measured |
| +104ms against 500ms; all screen measurements passed. |
| + |
| +Additional commands, with CGO_ENABLED=0: |
| + |
| +| Command | Before fix | After fix | |
| +| --- | --- | --- | |
| +| `go test ./internal/runner/provider -run '^TestAccountHomeMutation$/lock_release_with_inherited_descriptor$' -count=1` | Exit 1, account busy | Included in passing lock checks below | |
| +| `go test ./internal/runner/provider -run '^TestAccountHomeMutation$/lock' -count=1` | Not run | Exit 0 | |
| +| `go test ./internal/tryequipo -run '^TestHomeLockReleaseWithInheritedDescriptor$' -count=1` | Exit 1, lock retained | Included in the three passing package runs | |
| +| `go test ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$/inventory$' -count=1` | Failed in full gate | Exit 0 | |
| + |
| +The lease-unlock and guide-unlock overlays remove each explicit unlock. Running |
| +its regression command above with `-overlay=<scratch>/<name>.json` exited 1 at |
| +the intended lock assertion in both cases. Working source was unchanged. All |
| +ten deliberate mutations were caught. |
| + |
| +## Final gate |
| + |
| +R4: Run `make -k ci` after freezing all tracked changes, including this report. |
| +The final exit status and any retry are recorded in the commit body and the |
| +three-line handoff, so recording the outcome does not change the tested tree. |
| +No live gate, real sign-in, deployment, or copy-review server is authorized or |
| +started. Session scratch and mutation overlays are removed before handoff. |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index bab99072..b62de784 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -1031,7 +1031,7 @@ var runnerDraftCopy = map[string]string{ |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): recovery.uncontained |
| "recovery.uncontained": "Uncontained attempts", |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.preflight.unavailable |
| - // COPY REVIEW PENDING: account.sign_in_again |
| + // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): account.sign_in_again |
| "account.sign_in_again": "Sign in again", |
| "runner.preflight.unavailable": "Runner preflight is unavailable.", |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): api.unauthenticated |
| @@ -1108,59 +1108,59 @@ func RunnerSetupCopy(key string) string { return copyText(key) } |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): onboarding.first_instructions |
| var copyOnboardingFirstInstructions = pageCopy["onboarding.first_instructions"] |
| -// TryText returns pending guide copy, listed for the controller without a review server. |
| +// TryText returns the guide copy accepted for now by Paul. |
| func TryText(key string) string { return tryCopy[key] } |
| var tryCopy = map[string]string{ |
| - "config-value": "A configuration value contains unsupported shell characters. Correct that value and retry", // COPY REVIEW PENDING: try.config-value |
| - "foreign-file": "A generated file was changed outside the guide. Preserve that change and restore the generated file before retrying", // COPY REVIEW PENDING: try.foreign-file |
| - "input-required": "No valid answer was read. Run the guide from a terminal and answer the displayed question", // COPY REVIEW PENDING: try.input-required |
| - "saved-state": "Saved setup is invalid. Check state.json in the try folder before retrying", // COPY REVIEW PENDING: try.saved-state |
| - "private-file": "Setup needs a regular file with mode 0600. Correct the file permissions and retry", // COPY REVIEW PENDING: try.private-file |
| - "private-directory": "Setup needs an absolute, unlinked directory with mode 0700. Correct the path or permissions and retry", // COPY REVIEW PENDING: try.private-directory |
| - "go-required": "Missing prerequisite: Go. Install Go and run scripts/try-equipo.sh again.", // COPY REVIEW PENDING: try.go-required |
| - "guide-busy": "Another guide holds the setup lock. Wait for it to finish before retrying", // COPY REVIEW PENDING: try.guide-busy |
| - "login-failed": "The official sign-in did not finish. Follow its terminal instructions and run the guide again", // COPY REVIEW PENDING: try.login-failed |
| - "confirmation-required": "The account was not confirmed. Run the guide again to confirm it or lower the account count to drop it", // COPY REVIEW PENDING: try.confirmation-required |
| - "identity-mismatch": "The observed account does not match the confirmed identity. Sign in to the confirmed account in this dedicated home and retry", // COPY REVIEW PENDING: try.identity-mismatch |
| - "account-check": "Account validation failed. Check this dedicated home and sign in again through the guide", // COPY REVIEW PENDING: try.account-check |
| - "prerequisite-cause": "Cannot use %s: %v\n", // COPY REVIEW PENDING: try.prerequisite-cause |
| - "executable-hash": "Executable does not match its pinned hash. Install the pinned version and retry", // COPY REVIEW PENDING: try.executable-hash |
| - "executable-file": "Executable is not a runnable regular file. Correct its EQUIPO path or permissions", // COPY REVIEW PENDING: try.executable-file |
| - "executable-home": "Executable is inside an interactive or ZeroSub home. Install the pinned CLI outside those homes and set its EQUIPO path", // COPY REVIEW PENDING: try.executable-home |
| - "funding-invalid": "Funding limits must be positive whole numbers and seconds must be at most 86400. Enter valid limits on the next run", // COPY REVIEW PENDING: try.funding-invalid |
| - "forge-path": "The Amadan credential must be an absolute path to a regular file with mode 0600. Correct its path or permissions", // COPY REVIEW PENDING: try.forge-path |
| - "live-required": "The live gate was not authorized. Run the guide again and type RUN LIVE GATE to continue", // COPY REVIEW PENDING: try.live-required |
| - "signin-required": "Sign-in was not authorized. Run the guide again and type SIGN IN to continue", // COPY REVIEW PENDING: try.signin-required |
| - "root-user": "Root cannot run this guide. Run it as your own user", // COPY REVIEW PENDING: try.root-user |
| - "system-home": "The system home could not be found. Check your operating system account before retrying", // COPY REVIEW PENDING: try.system-home |
| - "terminal": "No terminal is available. Run the guide from an interactive terminal", // COPY REVIEW PENDING: try.terminal |
| - "claude-accounts": "Total Claude accounts to connect", // COPY REVIEW PENDING: try.claude-accounts |
| - "codex-accounts": "Total Codex accounts to connect", // COPY REVIEW PENDING: try.codex-accounts |
| - "account-minimum": "Enter a whole number of at least %d. Keep all confirmed accounts connected. Lower the count to drop an unconfirmed account.\n", // COPY REVIEW PENDING: try.account-minimum |
| - "duplicate-account": "This account is already connected in another home. Run the guide again and sign in to a different account.\n", // COPY REVIEW PENDING: try.duplicate-account |
| - "prerequisite": "Missing prerequisite: %s. Install the pinned version outside interactive homes and run the guide again.\n", // COPY REVIEW PENDING: try.prerequisite |
| - "prompt": "%s [%s]: ", // COPY REVIEW PENDING: try.prompt |
| - "confirm": "Observed account for %s: %s. Confirm this account? [yes/no]: ", // COPY REVIEW PENDING: try.confirm |
| - "login": "Signing in to %s in its dedicated home. Follow the official CLI instructions in this terminal.\n", // COPY REVIEW PENDING: try.login |
| - "failed": "Stopped at %s: %v. Correct the cause above. Saved setup can be resumed by running scripts/try-equipo.sh again. No release was made.\n", // COPY REVIEW PENDING: try.failed |
| - "ready": "Manifest candidate: %s\nAfter reviewing and importing the evidence bundle and candidate manifest, the controller releases with:\n%s\n", // COPY REVIEW PENDING: try.ready |
| - "live": "Type RUN LIVE GATE to authorize the displayed limits and disposable exercises", // COPY REVIEW PENDING: try.live |
| - "signin": "Type SIGN IN to start official sign-ins in dedicated homes", // COPY REVIEW PENDING: try.signin |
| - "instance": "Instance ID from Equipo", // COPY REVIEW PENDING: try.instance |
| - "person": "Your Equipo person ID", // COPY REVIEW PENDING: try.person |
| - "claude-model": "Exact Claude model", // COPY REVIEW PENDING: try.claude-model |
| - "codex-model": "Exact Codex model", // COPY REVIEW PENDING: try.codex-model |
| - "forge": "Absolute path to the runner's Amadan credential file", // COPY REVIEW PENDING: try.forge |
| - "Calls": "Maximum calibration calls", // COPY REVIEW PENDING: try.Calls |
| - "InputTokens": "Maximum calibration input tokens", // COPY REVIEW PENDING: try.InputTokens |
| - "OutputTokens": "Maximum calibration output tokens", // COPY REVIEW PENDING: try.OutputTokens |
| - "Seconds": "Maximum calibration seconds", // COPY REVIEW PENDING: try.Seconds |
| - "JobInput": "Job input token funding", // COPY REVIEW PENDING: try.JobInput |
| - "JobOutput": "Job output token funding", // COPY REVIEW PENDING: try.JobOutput |
| - "ProjectInputHeadroom": "Remaining project input tokens", // COPY REVIEW PENDING: try.ProjectInputHeadroom |
| - "ProjectOutputHeadroom": "Remaining project output tokens", // COPY REVIEW PENDING: try.ProjectOutputHeadroom |
| - "TeamInputHeadroom": "Remaining team input tokens", // COPY REVIEW PENDING: try.TeamInputHeadroom |
| - "TeamOutputHeadroom": "Remaining team output tokens", // COPY REVIEW PENDING: try.TeamOutputHeadroom |
| - "limits": "Authorized limits: %s\n", // COPY REVIEW PENDING: try.limits |
| + "config-value": "A configuration value contains unsupported shell characters. Correct that value and retry", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.config-value |
| + "foreign-file": "A generated file was changed outside the guide. Preserve that change and restore the generated file before retrying", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.foreign-file |
| + "input-required": "No valid answer was read. Run the guide from a terminal and answer the displayed question", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.input-required |
| + "saved-state": "Saved setup is invalid. Check state.json in the try folder before retrying", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.saved-state |
| + "private-file": "Setup needs a regular file with mode 0600. Correct the file permissions and retry", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.private-file |
| + "private-directory": "Setup needs an absolute, unlinked directory with mode 0700. Correct the path or permissions and retry", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.private-directory |
| + "go-required": "Missing prerequisite: Go. Install Go and run scripts/try-equipo.sh again.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.go-required |
| + "guide-busy": "Another guide holds the setup lock. Wait for it to finish before retrying", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.guide-busy |
| + "login-failed": "The official sign-in did not finish. Follow its terminal instructions and run the guide again", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.login-failed |
| + "confirmation-required": "The account was not confirmed. Run the guide again to confirm it or lower the account count to drop it", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.confirmation-required |
| + "identity-mismatch": "The observed account does not match the confirmed identity. Sign in to the confirmed account in this dedicated home and retry", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.identity-mismatch |
| + "account-check": "Account validation failed. Check this dedicated home and sign in again through the guide", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.account-check |
| + "prerequisite-cause": "Cannot use %s: %v\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.prerequisite-cause |
| + "executable-hash": "Executable does not match its pinned hash. Install the pinned version and retry", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.executable-hash |
| + "executable-file": "Executable is not a runnable regular file. Correct its EQUIPO path or permissions", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.executable-file |
| + "executable-home": "Executable is inside an interactive or ZeroSub home. Install the pinned CLI outside those homes and set its EQUIPO path", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.executable-home |
| + "funding-invalid": "Funding limits must be positive whole numbers and seconds must be at most 86400. Enter valid limits on the next run", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.funding-invalid |
| + "forge-path": "The Amadan credential must be an absolute path to a regular file with mode 0600. Correct its path or permissions", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.forge-path |
| + "live-required": "The live gate was not authorized. Run the guide again and type RUN LIVE GATE to continue", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.live-required |
| + "signin-required": "Sign-in was not authorized. Run the guide again and type SIGN IN to continue", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.signin-required |
| + "root-user": "Root cannot run this guide. Run it as your own user", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.root-user |
| + "system-home": "The system home could not be found. Check your operating system account before retrying", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.system-home |
| + "terminal": "No terminal is available. Run the guide from an interactive terminal", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.terminal |
| + "claude-accounts": "Total Claude accounts to connect", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.claude-accounts |
| + "codex-accounts": "Total Codex accounts to connect", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.codex-accounts |
| + "account-minimum": "Enter a whole number of at least %d. Keep all confirmed accounts connected. Lower the count to drop an unconfirmed account.\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.account-minimum |
| + "duplicate-account": "This account is already connected in another home. Run the guide again and sign in to a different account.\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.duplicate-account |
| + "prerequisite": "Missing prerequisite: %s. Install the pinned version outside interactive homes and run the guide again.\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.prerequisite |
| + "prompt": "%s [%s]: ", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.prompt |
| + "confirm": "Observed account for %s: %s. Confirm this account? [yes/no]: ", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.confirm |
| + "login": "Signing in to %s in its dedicated home. Follow the official CLI instructions in this terminal.\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.login |
| + "failed": "Stopped at %s: %v. Correct the cause above. Saved setup can be resumed by running scripts/try-equipo.sh again. No release was made.\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.failed |
| + "ready": "Manifest candidate: %s\nAfter reviewing and importing the evidence bundle and candidate manifest, the controller releases with:\n%s\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.ready |
| + "live": "Type RUN LIVE GATE to authorize the displayed limits and disposable exercises", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.live |
| + "signin": "Type SIGN IN to start official sign-ins in dedicated homes", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.signin |
| + "instance": "Instance ID from Equipo", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.instance |
| + "person": "Your Equipo person ID", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.person |
| + "claude-model": "Exact Claude model", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.claude-model |
| + "codex-model": "Exact Codex model", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.codex-model |
| + "forge": "Absolute path to the runner's Amadan credential file", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.forge |
| + "Calls": "Maximum calibration calls", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.Calls |
| + "InputTokens": "Maximum calibration input tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.InputTokens |
| + "OutputTokens": "Maximum calibration output tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.OutputTokens |
| + "Seconds": "Maximum calibration seconds", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.Seconds |
| + "JobInput": "Job input token funding", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.JobInput |
| + "JobOutput": "Job output token funding", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.JobOutput |
| + "ProjectInputHeadroom": "Remaining project input tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.ProjectInputHeadroom |
| + "ProjectOutputHeadroom": "Remaining project output tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.ProjectOutputHeadroom |
| + "TeamInputHeadroom": "Remaining team input tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.TeamInputHeadroom |
| + "TeamOutputHeadroom": "Remaining team output tokens", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.TeamOutputHeadroom |
| + "limits": "Authorized limits: %s\n", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): try.limits |
| } |
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go| index 78cea256..8d735c5b 100644 |
| --- a/internal/plan3test/plan3_release_test.go |
| +++ b/internal/plan3test/plan3_release_test.go |
| @@ -170,8 +170,9 @@ func plan3CopyInventory(t *testing.T) { |
| } |
| key := strings.TrimPrefix(strings.TrimSuffix(cells[0], "`"), "| `") |
| rows[key] = html.UnescapeString(strings.ReplaceAll(cells[1], "<br>", "\n")) |
| - if !strings.Contains(cells[3], "COPY REVIEW REQUIRED") { |
| - t.Fatal("unreviewed entry marked reviewed", key) |
| + acceptedGuide := strings.HasPrefix(cells[2], "Guided live gate") && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)" |
| + if !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedGuide { |
| + t.Fatal("entry has no copy review status or applicable acceptance", key) |
| } |
| } |
| } |
diff --git a/internal/runner/provider/accounts.go b/internal/runner/provider/accounts.go| index f26d14c2..f05c0b92 100644 |
| --- a/internal/runner/provider/accounts.go |
| +++ b/internal/runner/provider/accounts.go |
| @@ -668,7 +668,10 @@ func (l *AccountLease) Close() error { |
| } else { |
| cleanup = errors.Join(cleanup, ErrContainment) |
| } |
| - return errors.Join(cleanup, l.dir.Close()) |
| + // A concurrent fork can retain this descriptor until exec, even with |
| + // close-on-exec set. Release the lock before closing our copy. |
| + unlock := unix.Flock(int(l.dir.Fd()), unix.LOCK_UN) |
| + return errors.Join(cleanup, unlock, l.dir.Close()) |
| } |
| func (l *AccountLease) validateLaunch() error { |
diff --git a/internal/runner/provider/accounts_test.go b/internal/runner/provider/accounts_test.go| index 44fd36dd..06e6ba2f 100644 |
| --- a/internal/runner/provider/accounts_test.go |
| +++ b/internal/runner/provider/accounts_test.go |
| @@ -11,6 +11,8 @@ import ( |
| "strconv" |
| "strings" |
| "testing" |
| + |
| + "golang.org/x/sys/unix" |
| ) |
| func accountFixture(t *testing.T) (Binding, HomeRules) { |
| @@ -199,6 +201,19 @@ func TestAccountHomeMutation(t *testing.T) { |
| l.Close() |
| openFixture(t, b, r) |
| }) |
| + t.Run("lock release with inherited descriptor", func(t *testing.T) { |
| + b, r := accountFixture(t) |
| + l := openFixture(t, b, r) |
| + inherited, err := unix.FcntlInt(l.dir.Fd(), unix.F_DUPFD_CLOEXEC, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer unix.Close(inherited) |
| + if err := l.Close(); err != nil { |
| + t.Fatal(err) |
| + } |
| + openFixture(t, b, r) |
| + }) |
| for _, kind := range []string{"successful refresh", "failed refresh", "identity change", "active change"} { |
| t.Run(kind, func(t *testing.T) { |
| b, r := accountFixture(t) |
diff --git a/internal/tryequipo/accounts.go b/internal/tryequipo/accounts.go| index defe25f6..c4369db1 100644 |
| --- a/internal/tryequipo/accounts.go |
| +++ b/internal/tryequipo/accounts.go |
| @@ -43,7 +43,7 @@ func (w *Wizard) account(ctx context.Context, key, family, binary string) (provi |
| if err != nil { |
| return provider.Binding{}, err |
| } |
| - defer lock.Close() |
| + defer closeHomeLock(lock) |
| if err = unix.Flock(int(lock.Fd()), unix.LOCK_EX|unix.LOCK_NB); err != nil { |
| return provider.Binding{}, provider.ErrAccountBusy |
| } |
| @@ -175,3 +175,9 @@ func (w *Wizard) validateAccount(ctx context.Context, b provider.Binding) error |
| } |
| return err |
| } |
| + |
| +func closeHomeLock(lock *os.File) error { |
| + // A concurrent fork may retain the descriptor until exec. |
| + unlock := unix.Flock(int(lock.Fd()), unix.LOCK_UN) |
| + return errors.Join(unlock, lock.Close()) |
| +} |
diff --git a/internal/tryequipo/executable.go b/internal/tryequipo/executable.go| index d829d37f..9ad02067 100644 |
| --- a/internal/tryequipo/executable.go |
| +++ b/internal/tryequipo/executable.go |
| @@ -3,11 +3,12 @@ package tryequipo |
| import ( |
| "os" |
| "path/filepath" |
| + "strings" |
| "amadan.net/oficina/equipo/internal/runner/provider" |
| ) |
| -func executablePath(path string) (string, error) { |
| +func executablePath(path string, packages bool) (string, error) { |
| absolute, err := filepath.Abs(path) |
| if err != nil { |
| return "", err |
| @@ -17,7 +18,7 @@ func executablePath(path string) (string, error) { |
| return "", err |
| } |
| rules := provider.DefaultHomeRules() |
| - if rules.RefusesPath(absolute) || rules.RefusesPath(real) { |
| + if !executableSourceAllowed(absolute, rules, packages) || !executableSourceAllowed(real, rules, packages) { |
| return "", refusal("executable-home", provider.ErrPolicy) |
| } |
| st, err := os.Stat(real) |
| @@ -29,8 +30,46 @@ func executablePath(path string) (string, error) { |
| } |
| return real, nil |
| } |
| + |
| +func executableSourceAllowed(path string, rules provider.HomeRules, packages bool) bool { |
| + if !packages || !rules.RefusesPath(path) { |
| + return !rules.RefusesPath(path) |
| + } |
| + home, err := SystemHome() |
| + if err != nil { |
| + return false |
| + } |
| + codexHomes := []string{filepath.Join(home, ".codex")} |
| + if configured := os.Getenv("CODEX_HOME"); configured != "" { |
| + absolute, err := filepath.Abs(configured) |
| + if err != nil { |
| + return false |
| + } |
| + codexHomes = append(codexHomes, absolute) |
| + } |
| + for _, home := range codexHomes { |
| + if real, err := filepath.EvalSymlinks(home); err == nil && real != home { |
| + codexHomes = append(codexHomes, real) |
| + } |
| + } |
| + var forbidden []string |
| + for _, home := range rules.InteractiveHomes { |
| + packageSource := false |
| + for _, codexHome := range codexHomes { |
| + if home == codexHome && strings.HasPrefix(path, filepath.Join(home, "packages")+string(os.PathSeparator)) { |
| + packageSource = true |
| + } |
| + } |
| + if !packageSource { |
| + forbidden = append(forbidden, home) |
| + } |
| + } |
| + rules.InteractiveHomes = forbidden |
| + return !rules.RefusesPath(path) |
| +} |
| + |
| func pinExecutable(source, dir, name, hash string) (string, error) { |
| - source, err := executablePath(source) |
| + source, err := executablePath(source, name == "codex" || name == "codex-code-mode-host") |
| if err != nil { |
| return "", err |
| } |
| @@ -41,6 +80,9 @@ func pinExecutable(source, dir, name, hash string) (string, error) { |
| if provider.DigestDirectEvidence(raw) != hash { |
| return "", refusal("executable-hash", provider.ErrPolicy) |
| } |
| + if provider.DefaultHomeRules().RefusesPath(filepath.Join(dir, name)) { |
| + return "", refusal("executable-home", provider.ErrPolicy) |
| + } |
| if err := privateDir(dir); err != nil { |
| return "", err |
| } |
diff --git a/internal/tryequipo/executable_test.go b/internal/tryequipo/executable_test.go| new file mode 100644 |
| index 00000000..283cfc13 |
| --- /dev/null |
| +++ b/internal/tryequipo/executable_test.go |
| @@ -0,0 +1,154 @@ |
| +package tryequipo |
| + |
| +import ( |
| + "bytes" |
| + "os" |
| + "path/filepath" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| +) |
| + |
| +func testReviewPackageExecutables(t *testing.T) { |
| + root := t.TempDir() |
| + home := filepath.Join(root, "interactive") |
| + t.Setenv("CODEX_HOME", home) |
| + t.Setenv("CLAUDE_CONFIG_DIR", filepath.Join(root, "claude")) |
| + raw := []byte("#!/bin/sh\nexit 0\n") |
| + hash := provider.DigestDirectEvidence(raw) |
| + write := func(path string) { |
| + t.Helper() |
| + if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.WriteFile(path, raw, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + packages := filepath.Join(home, "packages", "standalone", "releases", "pinned", "bin") |
| + source := filepath.Join(packages, "codex") |
| + write(source) |
| + write(filepath.Join(packages, "codex-code-mode-host")) |
| + alias := filepath.Join(root, "codex-alias") |
| + if err := os.Symlink(source, alias); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, tc := range []struct { |
| + name, source, hash, destination string |
| + accept bool |
| + }{ |
| + {"matching", source, hash, "try/matching", true}, |
| + {"wrong-hash", source, "wrong", "try/wrong", false}, |
| + {"symlink", alias, hash, "try/symlink", true}, |
| + {"non-packages", filepath.Join(home, "config", "codex"), hash, "try/config", false}, |
| + {"packages-prefix", filepath.Join(home, "packages-other", "codex"), hash, "try/prefix", false}, |
| + {"other-home", filepath.Join(root, "claude", "packages", "codex"), hash, "try/claude", false}, |
| + {"zerosub", filepath.Join(root, ".paseo/zerosub/homes/account/packages/codex"), hash, "try/zero", false}, |
| + {"destination-home", source, hash, "interactive/bin", false}, |
| + {"destination-packages", source, hash, "interactive/packages/copy", false}, |
| + {"destination-claude", source, hash, "claude/bin", false}, |
| + {"destination-zerosub", source, hash, ".paseo/zerosub/homes/account/bin", false}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + if tc.source != alias { |
| + write(tc.source) |
| + } |
| + dir := filepath.Join(root, tc.destination) |
| + got, err := pinExecutable(tc.source, dir, "codex", tc.hash) |
| + if !tc.accept { |
| + if err == nil { |
| + t.Fatal("forbidden executable copied") |
| + } |
| + if _, err := os.Lstat(filepath.Join(dir, "codex")); !os.IsNotExist(err) { |
| + t.Fatal("refused copy left a destination", err) |
| + } |
| + return |
| + } |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + copied, err := os.ReadFile(got) |
| + if err != nil || !bytes.Equal(copied, raw) { |
| + t.Fatal("copy bytes differ", err) |
| + } |
| + original, err := os.Stat(source) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + info, err := os.Stat(got) |
| + if err != nil || got != filepath.Join(dir, "codex") || info.Mode().Perm() != 0700 || os.SameFile(original, info) { |
| + t.Fatal("not a private, independent copy", got, err) |
| + } |
| + }) |
| + } |
| + t.Run("configured-sibling", func(t *testing.T) { |
| + t.Setenv("EQUIPO_CODEX_PATH", alias) |
| + codex, err := resolveExecutable("codex", os.Getenv("EQUIPO_CODEX_PATH"), "") |
| + if err != nil || codex != source { |
| + t.Fatal("configured Codex not resolved", codex, err) |
| + } |
| + host, err := resolveExecutable("codex-code-mode-host", "/ignored/host", codex) |
| + if err != nil || host != filepath.Join(packages, "codex-code-mode-host") { |
| + t.Fatal("sibling host not resolved", host, err) |
| + } |
| + got, err := pinExecutable(host, filepath.Join(root, "try", "host"), "codex-code-mode-host", hash) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + copied, err := os.ReadFile(got) |
| + if err != nil || !bytes.Equal(copied, raw) { |
| + t.Fatal("sibling host not copied", err) |
| + } |
| + }) |
| + t.Run("symlink-escape", func(t *testing.T) { |
| + outside := filepath.Join(home, "config", "codex") |
| + write(outside) |
| + link := filepath.Join(packages, "escape") |
| + if err := os.Symlink(outside, link); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := pinExecutable(link, filepath.Join(root, "try", "escape"), "codex", hash); err == nil { |
| + t.Fatal("packages symlink escaped to config") |
| + } |
| + }) |
| + t.Run("symlink-from-config", func(t *testing.T) { |
| + write(filepath.Join(home, "config", "codex")) |
| + link := filepath.Join(home, "config", "alias") |
| + if err := os.Symlink(source, link); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := pinExecutable(link, filepath.Join(root, "try", "config-alias"), "codex", hash); err == nil { |
| + t.Fatal("config alias accepted") |
| + } |
| + }) |
| + t.Run("unpinned-tool", func(t *testing.T) { |
| + if _, err := resolveExecutable("go", source, ""); err == nil { |
| + t.Fatal("unhashed tool accepted from packages") |
| + } |
| + }) |
| + t.Run("default-home", func(t *testing.T) { |
| + systemHome, err := SystemHome() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + rules := provider.DefaultHomeRules() |
| + defaultHome := filepath.Join(systemHome, ".codex") |
| + if !executableSourceAllowed(filepath.Join(defaultHome, "packages", "codex"), rules, true) || executableSourceAllowed(filepath.Join(defaultHome, "config", "codex"), rules, true) { |
| + t.Fatal("default Codex home exception is not limited to packages") |
| + } |
| + }) |
| + t.Run("overlapping-home", func(t *testing.T) { |
| + t.Setenv("CLAUDE_CONFIG_DIR", packages) |
| + if _, err := pinExecutable(source, filepath.Join(root, "try", "overlap"), "codex", hash); err == nil { |
| + t.Fatal("package exception overrode another home") |
| + } |
| + }) |
| + t.Run("zerosub-codex-home", func(t *testing.T) { |
| + zeroHome := filepath.Join(root, ".paseo/zerosub/homes/account") |
| + write(filepath.Join(zeroHome, "packages", "codex")) |
| + t.Setenv("CODEX_HOME", zeroHome) |
| + if _, err := pinExecutable(filepath.Join(zeroHome, "packages", "codex"), filepath.Join(root, "try", "zero-home"), "codex", hash); err == nil { |
| + t.Fatal("package exception overrode ZeroSub home") |
| + } |
| + }) |
| +} |
diff --git a/internal/tryequipo/home_lock_test.go b/internal/tryequipo/home_lock_test.go| new file mode 100644 |
| index 00000000..a458f9bb |
| --- /dev/null |
| +++ b/internal/tryequipo/home_lock_test.go |
| @@ -0,0 +1,36 @@ |
| +package tryequipo |
| + |
| +import ( |
| + "os" |
| + "testing" |
| + |
| + "golang.org/x/sys/unix" |
| +) |
| + |
| +func TestHomeLockReleaseWithInheritedDescriptor(t *testing.T) { |
| + root := t.TempDir() |
| + lock, err := os.Open(root) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer lock.Close() |
| + if err := unix.Flock(int(lock.Fd()), unix.LOCK_EX|unix.LOCK_NB); err != nil { |
| + t.Fatal(err) |
| + } |
| + inherited, err := unix.FcntlInt(lock.Fd(), unix.F_DUPFD_CLOEXEC, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer unix.Close(inherited) |
| + if err := closeHomeLock(lock); err != nil { |
| + t.Fatal(err) |
| + } |
| + next, err := os.Open(root) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer next.Close() |
| + if err := unix.Flock(int(next.Fd()), unix.LOCK_EX|unix.LOCK_NB); err != nil { |
| + t.Fatal("closed home lock retained by inherited descriptor", err) |
| + } |
| +} |
diff --git a/internal/tryequipo/prerequisites.go b/internal/tryequipo/prerequisites.go| index c3ee0b31..0b85b85e 100644 |
| --- a/internal/tryequipo/prerequisites.go |
| +++ b/internal/tryequipo/prerequisites.go |
| @@ -92,5 +92,5 @@ func resolveExecutable(name, configured, codexSource string) (string, error) { |
| if err != nil { |
| return "", err |
| } |
| - return executablePath(path) |
| + return executablePath(path, name == "codex" || name == "codex-code-mode-host") |
| } |
diff --git a/internal/tryequipo/review_fixes_test.go b/internal/tryequipo/review_fixes_test.go| index 002785ab..d8e32bd0 100644 |
| --- a/internal/tryequipo/review_fixes_test.go |
| +++ b/internal/tryequipo/review_fixes_test.go |
| @@ -84,6 +84,7 @@ print(data.decode()) |
| } |
| func TestReviewPrivateExecutables(t *testing.T) { |
| + t.Run("packages", testReviewPackageExecutables) |
| root := t.TempDir() |
| source := filepath.Join(root, "source") |
| raw := []byte("#!/bin/sh\nexit 0\n") |
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json| index dd6c99e4..6ad11c03 100644 |
| --- a/scripts/runner-reference-allowlist.json |
| +++ b/scripts/runner-reference-allowlist.json |
| @@ -7194,5 +7194,26 @@ |
| "match": "paseo", |
| "count": 1, |
| "reason": "Offline regression fixture builds or invokes the dedicated runner without provider calls." |
| + }, |
| + { |
| + "path": "internal/tryequipo/executable_test.go", |
| + "line_sha256": "220f8f9a301d7b8e89de0c893dff49091a95cb2cac7f56ffb0b24faba3054f22", |
| + "match": "paseo", |
| + "count": 1, |
| + "reason": "Regression fixture verifies rejection of ZeroSub credential-home sources and copy destinations." |
| + }, |
| + { |
| + "path": "internal/tryequipo/executable_test.go", |
| + "line_sha256": "3ec5fd8addd681ec2b42fa39e8fe53ee2f636c196d5700c424092501e9847dc4", |
| + "match": "paseo", |
| + "count": 1, |
| + "reason": "Regression fixture verifies rejection of ZeroSub credential-home sources and copy destinations." |
| + }, |
| + { |
| + "path": "internal/tryequipo/executable_test.go", |
| + "line_sha256": "d94c4bbdade9236104715453a0e0afcea615e28b50a96bfdd9f4960a9e9d2f6e", |
| + "match": "paseo", |
| + "count": 1, |
| + "reason": "Regression fixture verifies rejection of ZeroSub credential-home sources and copy destinations." |
| } |
| ] |