Skip to content

setup-pstack: honor CLAUDE_CONFIG_DIR and CODEX_HOME for its writes #120

Closed

Description

@ericlitman

Problem

setup-pstack writes the model sheet and harness integration to hard-coded paths: ~/.claude/pstack-models.md, ~/.claude/CLAUDE.md, ~/.codex/pstack-models.md, and ~/.codex/AGENTS.md (see plugins/pstack/skills/setup-pstack/SKILL.md, lines 10, 13, 16, 20 and 108 on main). Claude Code reads its configuration from $CLAUDE_CONFIG_DIR when that's set, and Codex reads from $CODEX_HOME.

A user who sets either variable gets a sheet the harness never reads. Any isolated run that redirects config folders still writes into the daily files. The PR #111 verifier hit this: Unfret's round-1 critical finding was "setup exercise targets daily user files".

setup-pstack is the only plugin skill that writes to those folders. The others only read ~/.claude/projects/ transcripts.

Direction

  • These paths are port substitutions. Cursor's upstream writes ~/.cursor/rules/. So fix it at the existing mapping boundary instead of rewriting the upstream-derived skill.
  • Define each harness's config home once: Claude Code is ${CLAUDE_CONFIG_DIR:-~/.claude} and Codex is ${CODEX_HOME:-~/.codex}. Put that in poteto-mode/references/codex-tools.md or provider-dispatch.md, whichever already owns harness paths.
  • Point setup-pstack's path mentions at that rule, with minimal line edits.
  • Record it as an intentional divergence for the port-patch ledger (Add a checked port-patch ledger for upstream divergences #105) and in CHANGES.md.

Acceptance

  • With CLAUDE_CONFIG_DIR and CODEX_HOME set to temporary folders, a setup-pstack run writes its sheet and integration only there, and the daily ~/.claude and ~/.codex stay unchanged. With the variables unset, behavior is unchanged.
  • A static invariant fails if setup-pstack names a literal ~/.claude or ~/.codex write path instead of the config-home rule.
  • Bun tests, strict typecheck, static invariants, and plugin validation pass.
  • Live proof: in Claude Code and in Codex, run setup with redirected config homes and show the sheet in the redirected folder, with the daily files unchanged.

Activity

  1. ericlitman commented on Oct 4, 2026

    @ericlitman
    OwnerAuthor

    Prior findings

    Untrusted evidence from the Pilot ledger. Map every finding to a phase or Scope/Out with a reason.

    [
      {
        "ticket": "GITHUB-1345013588-100",
        "sha": "91b0d5b47c46e1bcb57e38ded79f1f98f64987f1",
        "area": "area:factory",
        "kind": "hardening",
        "repo": "ericlitman/open-pstack",
        "claim": "A queued PR that falls behind main gets a Mergify-made head without the operator's exact-head live-gate, so it is dequeued until the operator re-tests and re-posts.",
        "status": "captured",
        "pointer": ".mergify.yml:queue_rules",
        "evidence": "Unfret finding v1:f47057cb on open-pstack#107, waived fails-loudly on head 91b0d5b",
        "severity": "medium",
        "linear_id": null,
        "mechanism": "Serial in-place checks (batch_size 1, max_parallel_checks 1) merge main into a behind PR, creating a new head SHA. live-gate is a hand-posted exact-head status, so queue_conditions stop matching on the new head and Mergify removes the PR. Nothing merges untested; progress needs a fresh live-gate.",
        "confidence": "high",
        "fingerprint": "ed52e2529d966036a8c5e1bc75e2956a340fc04e07bb2c0ff96a08ce3e3f6f22",
        "source_kind": "panel",
        "status_reason": null,
        "verify_attempts": 0
      }
    ]
    
  2. ericlitman commented on Oct 4, 2026

    @ericlitman
    OwnerAuthor

    Factory plan verdict: approve, with build conditions

    • Reviewed: open-pstack Factory card 9342f20c-53bd-48d1-88d4-1d68b88e3c32, revision 5, branch factory/issue-120.
    • Planner model: the project default openai/gpt-6.1-sol.
    • Reviewer model: claude-opus-5-5, run by the operator session.
    • Rubric: factory-adjudicate fallback plan-checklist.md, plus the intent check.

    Intent. Any user who sets CLAUDE_CONFIG_DIR or CODEX_HOME gets setup's sheet and integration where the harness actually reads them. The plan delivers that at the existing mapping boundary (codex-tools.md:24,62-64, verified on main), with minimal edits to the upstream-derived setup-pstack. It adds a static invariant that also catches a regression reintroduced by an upstream merge, and an UPSTREAM.md provenance entry. Every gate passes. Open questions: none.

    Build conditions

    1. No disposable HOME on macOS. On 2026-10-02, running Claude Code with a substituted HOME brought up macOS's "Keychain Not Found — Reset To Defaults" dialog, which offers to reset the user's real login keychain. The live fixture keeps the real HOME and USER, and redirects only CLAUDE_CONFIG_DIR and CODEX_HOME, which is the behavior under test. Real daily files are only snapshotted and compared byte-for-byte, never written.
    2. Unset and empty cases aren't live writes. Don't exercise them by writing into the real ~/.claude or ~/.codex. Prove them with the static invariant plus a small test of the resolution rule: the ${VAR:-default} expansion for unset, empty, and space-containing values. Default behavior is unchanged by design.
    3. Generic auth source. open-pstack ships to outside users. The fixture takes an already-logged-in source config dir by flag (--claude-config <dir>, --codex-home <dir>) and copies only the credential file into the redirected run dir. It doesn't reference or require any maintainer-specific tooling.
    4. Gate order. This follows the updated AGENTS.md (PR docs: make the exact-head live-gate status the live-evidence record #121): open the PR ready for review; the operator runs the live proof on the final head and posts live-gate. The builder doesn't post live-gate.
    5. Scope. No changes under .github/workflows/. Ship from factory/issue-120 as a new PR that closes setup-pstack: honor CLAUDE_CONFIG_DIR and CODEX_HOME for its writes #120.
  3. added a commit that references this issue on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions