fix(secretspec): supply a default activation reason so require_reason never blocks shell entry (RIG-2822) - #5
Merged
Conversation
… never blocks shell entry (RIG-2822)
secretspec 0.19+ added a `require_reason` policy defaulting to `"agents"`:
when the caller is detected as a coding agent and no reason is supplied,
every secret-access op fails with `SecretSpecError::ReasonRequired`,
independent of `required = false`. devenv's `use devenv` shell activation
resolves secrets in `resolve_secretspec_into` via a bare `secrets.validate()?`,
so any coding agent entering a devenv shell on a cold direnv cache (fresh
clone, or an edit to any watched file) is blocked outright — no toolchain.
This hit every repo on the fork (orion, compass, forge, infra).
Fix: chain `with_default_reason("devenv shell activation")` before `validate()`
at the activation resolve site. `with_default_reason` (secretspec 0.19+, already
bundled) fills a reason only when the caller set none, so an explicit
`SECRETSPEC_REASON` / `with_reason()` still wins and is what gets audited — the
reason gate is preserved for genuine interactive `secretspec get`/`export`,
while automatic shell activation self-describes and no longer blocks.
The other resolve path, `resolve_builtin_cachix_auth_token`, loads a manifest
that hardcodes `require_reason = false`, so it needs no reason and is untouched.
This is the fleet-wide fix that reverts the orion-side stopgap
(`require_reason = false` in orion's secretspec.toml, RIG-2550) once the lock
bump lands.
Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
marked this pull request as ready for review
August 27, 2026 03:10
mattwilkinsonn
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
secretspec 0.19+ added a
require_reasonpolicy defaulting to"agents": when the caller is detected as a coding agent (detect-coding-agent) and no reason is supplied (SECRETSPEC_REASONunset / nowith_reason()), every secret-access op fails withSecretSpecError::ReasonRequired, independent ofrequired = false.devenv's
use devenvshell activation resolves secrets inresolve_secretspec_into(devenv/src/devenv/mod.rs) via a baresecrets.validate()?, so any coding agent entering a devenv shell on a cold direnv cache (fresh clone, or an edit to any watched file — devenv.nix/.lock/.yaml/.envrc/toolchain pins) is blocked outright — no toolchain. This hit every repo on the fork (orion, compass, forge, infra).Fix
Chain
with_default_reason("devenv shell activation")beforevalidate()at the single activation resolve site (mod.rs:3703).with_default_reason(secretspec 0.19+, already bundled) fills a reason only when the caller set none, so an explicitSECRETSPEC_REASON/with_reason()still wins and is what gets audited — the reason gate is preserved for genuine interactivesecretspec get/export, while automatic shell activation self-describes and no longer blocks.The other resolve path,
resolve_builtin_cachix_auth_token, loads a manifest that hardcodesrequire_reason = false(mod.rs:313), so it needs no reason and is untouched. Upstream devenv already does the analogous thing there for its own Cachix manifest — this applies the same remedy at the project-activation point.Verification
nix build .#devenv— exit 0 (edited crate compiles againstsecretspec-0.19.1, the pinned revb90afe38).secretspecbinary on a minimalrequire_reason-default manifest:CLAUDECODE=1) + no reason →ReasonRequired, exit 1 (the bare-validate()pre-fix path)--reason→ exit 0CLAUDECODE=1 SECRETSPEC_REASON= devenv print-dev-envon that project → exit 0, noReasonRequired, full dev env emitted. Pre-fix this exits 1.Follow-through
devenv update devenvbump of orion'sdevenv.lock, then revert the RIG-2550 stopgap (require_reason = falsein orion'ssecretspec.toml) so the fleet runs the reason gate again with activation self-describing.cachix/devenv— the gate affects any agent using devenv + secretspec 0.19+, not just the fork.RIG-2822.
Co-authored-by: Matt Wilkinson matt@rigel.build