Skip to content

fix(setupagent): unprotect .stack config files and clear stale pending replies - #81

Merged
cooper (czxtm) merged 3 commits into
mainfrom
fix/setup-agent-stale-pending-reply
Nov 9, 2026
Merged

cooper (czxtm) merged 3 commits into
mainfrom
fix/setup-agent-stale-pending-reply

Conversation

@czxtm

@czxtm cooper (czxtm) commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes two failure modes in stack setup --experimental-agent and resolves the CI nix-bun failure:

  1. Preexisting untracked/modified .stack/ config files blocking claude setup (apps/stackpanel-go/cmd/cli/setup_agent.go, setup_agent_state.go):

    • When a repository already had .stack/config.nix, .stack/data.nix, or .stack/reconcile.json on disk (e.g. from running non-agent stack setup or nix flake init first), captureSetupGit treated them as protected user edits (ProtectedPaths) and flagged edits to .stack/config.nix as a GitViolation.
    • allowStackpanelConfig now excludes .stack/config.nix, .stack/data.nix, .stack/reconcile.json, and .stack/addons.json from gitGuard.protected and GitViolation.Protected, and clears stale PreviousError messages referencing .stack/config.nix / .stack/data.nix so resuming stack setup --experimental-agent claude can immediately write the agreed .stack/config.nix.
  2. Stale/unrecoverable PendingReply across runs & agents (apps/stackpanel-go/cmd/cli/setup_agent_reply.go, setup_agent.go):

    • Records Agent on setupReplyRecovery. When switching --experimental-agent during inspection or when PendingReply.Message is plain-text prose (not starting with {), discards state.PendingReply immediately so the selected agent runs a fresh inspection.
    • When ReplyCorrectionPrompt returns {"status":"blocked",...}, always clears state.PendingReply = nil and saves the manifest; if resuming inspection (read-only phase), falls back immediately to a fresh inspection turn instead of failing.
  3. Prevent zsh read-only temp file failures under codex (apps/stackpanel-go/internal/setupagent/agent.go, prompt.go):

    • Sets SHELL=/bin/sh (and strips ZDOTDIR) in codex's environment so shell tool calls do not invoke interactive zsh startup scripts or zsh temp-file heredocs on a read-only sandbox filesystem.
    • Removes --yolo from codex exec args so --sandbox read-only / workspace-write remain enforced.
  4. Restore cached flake.lock inputs and harden nix-bun CI action (flake.lock, nix/flake/integrations/prelude/flake-module.nix, .github/actions/nix-bun/action.yml):

    • Restores flake.lock to the revision cached in darkmatter.cachix.org (reverting an unintended lockfile bump from feat(flake): add devenvModules.default and disable unused Prelude workspace #77 that caused uncached GitHub tarball downloads to hit HTTP 504 timeouts on arc-ubuntu runners) and guards options.prelude.workspace.enable so it evaluates cleanly across both cached and newer prelude revisions.
    • Adds --accept-flake-config, GITHUB_TOKEN access-tokens configuration, and retry backoff to .github/actions/nix-bun/action.yml.

Test Plan

  • go test ./cmd/cli/... ./internal/setupagent/... in apps/stackpanel-go
  • ./tests/test-agent-setup.sh (all 23 end-to-end scenarios pass)
  • nix eval .#bun.outPath and GitHub Actions CI (CI Checks/typecheck, Deploy Web, Deploy Docs, CodeQL)

@czxtm cooper (czxtm) changed the title fix(setupagent): clear stale pending replies across agents and use /bin/sh for codex fix(setupagent): unprotect .stack config files and clear stale pending replies Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Preview deployed to pr-81 — https://pr-81.stackpanel.com

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Docs preview deployed to pr-81: https://stackpanel-docs-pr-81.drkmttr.workers.dev

@czxtm
cooper (czxtm) merged commit abacf5a into main Nov 9, 2026
14 checks passed
@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

ENG-1443

This branch was successfully deployed

2 active deployments
pr-81 — 7c3c925f Deployed Nov 8, 2026 by czxtm via deploy #277
docs-preview — 7c3c925f Deployed Nov 8, 2026 by czxtm via deploy #266
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