Skip to content

fix(apply-pack-interview): load .env before callCouncil — env-shadow-on-lazy-dotenv#337

Merged
mitwilli-create merged 1 commit into
mainfrom
fix/apply-pack-interview-env-shadow-2026-05-29-claude-1414
May 29, 2026
Merged

fix(apply-pack-interview): load .env before callCouncil — env-shadow-on-lazy-dotenv#337
mitwilli-create merged 1 commit into
mainfrom
fix/apply-pack-interview-env-shadow-2026-05-29-claude-1414

Conversation

@mitwilli-create
Copy link
Copy Markdown
Owner

Summary

Theme 7 PR 3 (#329) shipped scripts/agents/apply-pack-interview.mjs without a dotenv import. In any shell where ANTHROPIC_API_KEY is not already exported (Mitchell's shell pre-sets it to empty string), callCouncil silently returns { results: [], missingKeys: [{ model: 'anthropic:claude-sonnet-4-6', missingEnvVar: 'ANTHROPIC_API_KEY' }] } and the agent fails with the opaque message [plan] error: no result.

Surfaced 2026-05-29 on the first live exercise of /apply-pack-interview against row #1 (Anthropic Communications Manager, Research) — the live-exercise found a ship-blocker that the test suite couldn't see (tests use mocks, never call out to real callCouncil).

Fix

Load .env at script start with override:true (matches cv-tailor.mjs and the rest of the agent fleet). Per the existing env-shadow-on-lazy-dotenv bug class in AGENTS.md:

try {
  const { config } = await import('dotenv');
  config({ path: join(dirname(fileURLToPath(import.meta.url)), '..', '..', '.env'), override: true });
} catch { /* dotenv optional — silently skip if not installed */ }

The override:true flag is non-negotiable here because of how Mitchell's shell handles the env var.

Smoke test (passed)

$ node scripts/agents/apply-pack-interview.mjs --plan 001-anthropic-communications-manager-research
◇ injected env (82) from .env
[plan] generated 8 questions for 001-anthropic-communications-manager-research ($0.0521)
[plan] saved to /Users/.../data/apply-pack-interview-001-anthropic-communications-manager-research.json

Questions cover the expected revision surfaces: comms-manager-scope (cv-tailored), research-translation-proof / crisis-or-sensitive-comms / anthropic-safety-fluency (cover-letter), media-relationships / writing-sample-availability (form-fields), team-size-managed (cv-tailored), anthropic-internal-connection (referrals).

Test plan

  • Merge the PR
  • Re-run node scripts/agents/apply-pack-interview.mjs --plan <slug> in a fresh shell where ANTHROPIC_API_KEY="" is exported (the canonical failure-mode shell)
  • Confirm plan generates without [plan] error: no result

Related

  • Builds on feat(theme7): PR 3 — /apply-pack-interview skill + agent #329 (Theme 7 PR 3 — original /apply-pack-interview ship)
  • Companion bug-class: AGENTS.md ### Bug class: env-shadow-on-lazy-dotenv
  • Live-exercise that found this: 2026-05-29 R4 residual (apply-pack-interview on Anthropic Communications Manager, Research)

🤖 Generated with Claude Code

Theme 7 PR 3 (#329) shipped scripts/agents/apply-pack-interview.mjs
without a dotenv import. In any shell where ANTHROPIC_API_KEY is not
already exported (e.g., Mitchell's shell pre-sets it to empty string),
callCouncil silently returns { results: [], missingKeys: [...] } and
the agent fails with "[plan] error: no result" — opaque from the user's
perspective.

Fix: load .env at script start with override:true (matches cv-tailor.mjs
and the rest of the agent fleet). Surfaced 2026-05-29 on the first live
exercise of /apply-pack-interview for row #1 (Anthropic Communications
Manager, Research).

Bug class: env-shadow-on-lazy-dotenv (AGENTS.md, existing entry).

Smoke-tested:
- `node scripts/agents/apply-pack-interview.mjs --plan 001-...`
  successfully generated 8 questions ($0.0521) and wrote state file.
- Plan questions surface targeted gaps in cv-tailored / cover-letter /
  form-fields / referrals.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mitwilli-create mitwilli-create marked this pull request as ready for review May 29, 2026 22:11
@mitwilli-create mitwilli-create merged commit 99fd952 into main May 29, 2026
9 checks passed
@mitwilli-create mitwilli-create deleted the fix/apply-pack-interview-env-shadow-2026-05-29-claude-1414 branch May 29, 2026 22:11
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.

1 participant