Conversation
) The pre-spawn env-leak guard in ClaudeClient.sendQuery() and CodexClient.sendQuery() used `if (!codebase?.allow_env_keys)`, which evaluates truthy when `codebase` is null. Any sendQuery call with an unregistered cwd (title generation, codebase-less orchestrator runs, DAG executor paths) ran the sensitive-key scanner and threw EnvLeakError, blocking every conversation creation on deployed servers with a .env in scope. The pre-spawn check is defense-in-depth for registered codebases without explicit consent. Registration (registerRepoAtPath) is the canonical gate; unregistered cwd paths are out of scope. Changes: - claude.ts: tighten predicate to `codebase && !codebase.allow_env_keys` - codex.ts: same fix - claude.test.ts: add regression test for unregistered cwd; update existing tests that relied on the null-codebase path to use a registered codebase with allow_env_keys: false - codex.test.ts: same test updates Fixes #991
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe env-leak gate condition in two client files is modified to enforce scanning only when a registered codebase explicitly disallows environment key access, rather than treating unregistered codebases as blocked. Corresponding test coverage validates both registered and unregistered cwd scenarios. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🔍 Automated Code ReviewSummaryFix is minimal, correct, and symmetric across both Claude and Codex clients. Tests accurately reflect the new contract. No critical or important issues identified. Findings✅ Strengths
|
First post under a new docs site blog section. It's a post-mortem on the six bugs that broke every Archon binary release from v0.2.13 through v0.3.1: - #960 pino-pretty transport crash in compiled binaries - #961/#979 isBinaryBuild runtime detection fragility - #986/#987 release workflow bypassing scripts/build-binaries.sh - #988 SQLite schema missing allow_env_keys column - #990 Claude SDK cli.js path baked in at build time - #991/#992 env-leak gate firing on unregistered cwd paths Each bug masked the next. The test-release skill was the first thing that exercised the full chain (install the released binary on a clean machine, run real commands, verify end-to-end), and it found all six in sequence as the earlier layers got fixed. The post covers: - The bug onion metaphor and why it's particularly hard to debug - Each of the six bugs with root cause and fix PR - Why dev mode hid all of this - Why locally-built binaries passed all contributor tests but failed for every other user - The smoke test that finally broke the pattern - What changed in the release skill + what's still open - An honest 'note on blame' — the lesson is structural, not about being more careful Also adds a 'Blog' section to the Astro sidebar config so the new directory is discoverable. Positioned between Getting Started and Guides. Pre-post sanity check items for reviewer: - Factual accuracy of the bug-by-bug timeline - Whether to name the community contributor (leex279) explicitly or keep it generic - Whether the 'Note on blame' section is the right tone - Length (~3000 words) — fine for a post-mortem, could be trimmed to ~2000 for a shorter read
…d-gitlab-docs chore: remove old gitlab docs
…d-gitlab-docs chore: remove old gitlab docs
…oleam00#991) (coleam00#992) The pre-spawn env-leak guard in ClaudeClient.sendQuery() and CodexClient.sendQuery() used `if (!codebase?.allow_env_keys)`, which evaluates truthy when `codebase` is null. Any sendQuery call with an unregistered cwd (title generation, codebase-less orchestrator runs, DAG executor paths) ran the sensitive-key scanner and threw EnvLeakError, blocking every conversation creation on deployed servers with a .env in scope. The pre-spawn check is defense-in-depth for registered codebases without explicit consent. Registration (registerRepoAtPath) is the canonical gate; unregistered cwd paths are out of scope. Changes: - claude.ts: tighten predicate to `codebase && !codebase.allow_env_keys` - codex.ts: same fix - claude.test.ts: add regression test for unregistered cwd; update existing tests that relied on the null-codebase path to use a registered codebase with allow_env_keys: false - codex.test.ts: same test updates Fixes coleam00#991
…d-gitlab-docs chore: remove old gitlab docs
…oleam00#991) (coleam00#992) The pre-spawn env-leak guard in ClaudeClient.sendQuery() and CodexClient.sendQuery() used `if (!codebase?.allow_env_keys)`, which evaluates truthy when `codebase` is null. Any sendQuery call with an unregistered cwd (title generation, codebase-less orchestrator runs, DAG executor paths) ran the sensitive-key scanner and threw EnvLeakError, blocking every conversation creation on deployed servers with a .env in scope. The pre-spawn check is defense-in-depth for registered codebases without explicit consent. Registration (registerRepoAtPath) is the canonical gate; unregistered cwd paths are out of scope. Changes: - claude.ts: tighten predicate to `codebase && !codebase.allow_env_keys` - codex.ts: same fix - claude.test.ts: add regression test for unregistered cwd; update existing tests that relied on the null-codebase path to use a registered codebase with allow_env_keys: false - codex.test.ts: same test updates Fixes coleam00#991
Summary
The pre-spawn env-leak guard in
ClaudeClient.sendQuery()/CodexClient.sendQuery()usedif (!codebase?.allow_env_keys), which evaluates truthy whencodebaseisnull. AnysendQuerycall with an unregistered cwd — title generation, codebase-less orchestrator runs, DAG executor paths — ran the sensitive-key scanner and threwEnvLeakError, blocking every conversation creation on deployed servers whose.envis in scope.Root Cause
!undefined === true, so the defense-in-depth scanner branch was entered for unregistered paths it was never meant to cover. The canonical gate isregisterRepoAtPath()inclone.ts; the pre-spawn check only exists for registered codebases without explicit consent.Evidence:
packages/core/src/clients/claude.ts:279packages/core/src/clients/codex.ts:166packages/core/src/services/title-generator.ts:53→sendQuerywith unregistered cwd.Changes
packages/core/src/clients/claude.ts!codebase?.allow_env_keys→codebase && !codebase.allow_env_keyspackages/core/src/clients/codex.tspackages/core/src/clients/claude.test.tsallow_env_keys: falsepackages/core/src/clients/codex.test.tsTesting
bun run type-checkpassesbun --filter @archon/core testpasses (all 394+ tests)bun run lintpassesEnvLeakErrorallow_env_keys: true" path still skips scanWhy This Is Safe
The pre-spawn check is a safety net, not the primary gate:
allow_env_keys: true— still skippedallow_env_keyson, so gating there was a dead-end; registration remains the enforcement pointScope
This is the shallow fix. The deeper architectural issue — that four upstream code paths call
sendQuerywith an unregistered cwd at all — is tracked in a companion issue for post-v0.3.2.Issue
Fixes #991
Summary by CodeRabbit