Repository navigation
Restore Secret Buckets From the Bootstrap Before the GitHub Step - #4246
Conversation
A rebuilt host has no op and no checkout until the bootstrap has run, and its own SSH key may already be escrowed in a secret bucket. Restoring after the GitHub step would overwrite the key that step just registered. bootstrap.sh --secrets LIST and bootstrap.ps1 -Secrets LIST take bucket names separated by commas. On its own the option installs op and pulls exactly the named buckets through the new restore-secrets scripts, which drive scripts/secrets_sync.py. Given with --host or --dev it runs after the tools step and before the GitHub step, so a restored key is the one setup-github keeps. Any other action refuses it, and so does a root or elevated run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Linux loader named python3 where the installer manages python, so every --secrets run stopped at the install step. A test now checks that the tool names both loaders hand the installer are managed tools. A stand-up installs only op for the restore, since the profile already installed the interpreter. The PowerShell refusal names the actions given, -Secrets follows -FromTree so no earlier parameter moves, and the host doc states what a late pull does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The host-setup README and the Linux README list the restore pair among the programs a tree must hold, and every text naming the --secrets action says it installs the interpreter too. The README states that a dry run still reaches the sync's own sign-in. The missing-interpreter message no longer sends the user back to the tools step, which cannot raise a distro's version. The Windows dev stand-up test now counts the tools steps and orders the restore after them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
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. |
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟡 Changes recommended
Critical stale-PATH failures can prevent first-run secrets restoration on fresh hosts, and the dry-run commands may report interpreters different from those actually selected.
4 open issues
What changed in this PR
Adds bootstrap support for restoring named 1Password secret buckets before GitHub setup, allowing rebuilt hosts to reuse escrowed SSH keys.
Changes:
- Adds Linux and Windows restore scripts that validate bucket names and invoke
secrets_sync.py pull. - Integrates
--secretsand-Secretsinto standalone and host/development bootstrap flows. - Adds unit, bootstrap, CLI, documentation, and cold-start diagram coverage.
| File | Description |
|---|---|
| tests/test_restore_secrets.py | Tests Linux and PowerShell restore-script behavior with isolated tool and sync stubs. |
| tests/test_cli_usage.py | Registers the new restore scripts for CLI usage validation. |
| tests/test_bootstrap.py | Tests bootstrap dispatch, ordering, validation, failure handling, and managed tool behavior. |
| scripts/README.md | Documents bootstrap-based secret restoration for secrets_sync.py. |
| host-setup/windows/restore-secrets.ps1 | Implements Windows restoration of named secret buckets. |
| host-setup/windows/README.md | Documents the Windows secret restoration script. |
| host-setup/README.md | Documents the cross-platform bootstrap secret-restoration workflow and ordering. |
| host-setup/linux/restore-secrets.sh | Implements Linux restoration of named secret buckets. |
| host-setup/linux/README.md | Documents the Linux secret restoration script and its dependencies. |
| host-setup/bootstrap.sh | Adds Linux --secrets parsing and integration with standalone and stand-up flows. |
| host-setup/bootstrap.ps1 | Adds Windows -Secrets parsing and integration with standalone and stand-up flows. |
| docs/host-setup.md | Documents restoring secrets before GitHub configuration during host setup. |
| docs/fleet-map.md | Updates the cold-start flow to show the optional secret-restoration step. |
Review effort: Lite
The Windows restore runs in a fresh process after the tools installer changed the user and machine PATH, so it appends those entries before it looks for op. The restore's dry run names no interpreter, since the real run picks one at run time. The PowerShell restore function takes a singular noun, which the lint rule on cmdlet nouns requires. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4246 +/- ##
========================================
Coverage 78.03% 78.03%
========================================
Files 42 42
Lines 15381 15381
========================================
Hits 12002 12002
Misses 3379 3379
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The Windows dry-run case without op now checks the printed arguments as the Linux case does, so a dropped or garbled argument list fails it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
The cases run the bash script under a PATH of symlinked stubs, which Git Bash on a Windows runner cannot use for commands with no extension, so every case stopped at the script's first line. The PowerShell script cases already run only on a POSIX host, so the Windows runner now skips both classes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
@coderabbitai review |
|
/review |
Action not completed
|
…trap Secret Restore (#4255) ## Summary Promotes `develop` to `main`. It carries nine changes: - [#4247](#4247): retires the `CLAUDE.md` pointer file, the second half of #4074. The hub's copy and its `spec/files.json` entry are gone, and a `retire` gap records why. The audit now reports a retired path the hub no longer tracks. A copy matching a past hub revision is reported for deletion, and any other copy is reported for the maintainer. It merged on the maintainer's go-ahead after reading its diff, which touches `host-setup/agent-safety/README.md`. - [#4256](#4256): that match compares line endings alone, so a retired copy differing in an action pin or a `needs:` list goes to the maintainer. It answers a Copilot finding on this promotion. - [#4260](#4260): the audit run stamp names the commits it read. HEAD carries `-dirty` where the read paths differ from it, and `main <sha>` is added where the fetched `main` differs. - [#4259](#4259): `pr-review-conduct` states the `pr_review.py` spelling rule once for every call a fleet skill prints. Under a restricted uv cache, a merge or a branch delete is reported to the maintainer as a blocked write. - [#4261](#4261): `validate-task.yml` takes a `test-matrix-file` input, read through the same validation as `test-matrix`. - [#4257](#4257): the pre-commit snippet says to exclude `hub_fetch_run.py` from a repository's own ruff with `force-exclude = true`. The short-form `AUDIT.md` snippet drops its two hub-audit authority sentences. - [#4246](#4246): `bootstrap.sh --secrets` and `bootstrap.ps1 -Secrets` restore named secret buckets, on their own or as a step of a `--host` or `--dev` stand-up. - [#4250](#4250): `host-*` buckets in `scripts/secrets_sync.py` may each hold the same home-relative title. - [#4258](#4258): a dry run with no 1Password account is refused rather than enrolling one, and the root-refused secrets tests skip on a root runner. It answers two CodeRabbit findings on this promotion. Hosts already carry the load-both setting the retirement relies on, from the 2.0.1483 kit. Closes #4074 Closes #4236 Closes #4238 Closes #4239 Closes #4242 Closes #4243 Closes #4248 Closes #4249 🤖 Generated with [Claude Code](https://claude.com/claude-code)


Summary
bootstrap.sh --secrets LISTandbootstrap.ps1 -Secrets LISTtake bucket names separated by commas, each of lowercase letters, digits, and hyphens that start with a letter or digit.--secretsis an action. It installsopand the interpreter through the tools installer, then pulls exactly the named buckets into the home directory through the newhost-setup/linux/restore-secrets.shandhost-setup/windows/restore-secrets.ps1, which runscripts/secrets_sync.py pull.--hostor--devit is a step of the stand-up, not a second action. It runs after the tools step and beforesetup-github --configure, so a restored~/.ssh/id_ed25519is the key that step keeps.--hostadds onlyopfirst, since the profile installed the interpreter, and--devadds nothing.--yesand--dry-runpass through to each tool. The sync still signs in toopunder its own dry run, and the README says so.scripts/secrets_sync.pyis unchanged.Documented in
host-setup/README.md, the two platform READMEs,scripts/README.md"secrets_sync.py",docs/host-setup.md, and the cold-start diagram indocs/fleet-map.md.Verification
tests/test_restore_secrets.py(both scripts, stubopand stub sync, no realop, sudo,~/.secrets, or~/.ssh), end-to-endbootstrap.shcases intests/test_bootstrap.pywith stub tools recording full argument lists, and PowerShell cases that runbootstrap.ps1's own functions against stub tools. A test checks that the tool names both loaders handinstall-toolsare managed tools.pwshunder Linux. Native Windows verification is out of scope and stays with Verify the op Host Tool and secrets_sync.py Natively on Windows #4188. In particular, whether the processPATHsees anopthatwingetinstalled moments earlier is unconfirmed there.--secretsrun, false comments and docs, a redundant install, a parameter position, documentation lists made stale), all fixed.Notes
commentslabel is applied for the why-comments this change adds to the loaders and the two new scripts.Closes #4242
🤖 Generated with Claude Code