session-lifecycle-hook appends duplicate exports to CLAUDE_ENV_FILE on every SessionStart
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start in scripts/session-lifecycle-hook.mjs at appendEnvVar() and trace how it runs for SessionStart events. Reproduce repeated startup, resume, clear, or compact events using the existing hook entry point, then verify that CLAUDE_ENV_FILE contains only one export line per variable and that repeated events no longer grow the file.
Written by the indexing model from the issue text.
Description
scripts/session-lifecycle-hook.mjs appendEnvVar() uses fs.appendFileSync on every SessionStart (startup, resume, clear, compact). Claude Code keeps the same env file for the session, so a long-lived session collects one duplicate 3-line block per compaction (31 blocks, 9.5 KB seen). On Windows this helped push the Bash tool past an 8,186-char command limit and broke Bash in that session. Fix: skip lines already present, or rewrite the file each time. The local patch that does this:
const line = `export ${name}=${shellEscape(value)}`;
let existing = "";
try { existing = fs.readFileSync(process.env.CLAUDE_ENV_FILE, "utf8"); } catch {}
if (existing.split("\n").includes(line)) return;
fs.appendFileSync(process.env.CLAUDE_ENV_FILE, `${line}\n`, "utf8");
Related: anthropics/claude-code#97692
- Dominant language
- JavaScript
- Stars
- 34.2k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex-plugin-cc
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
openai/codex-plugin-cc#813 ·
-
codex-rescue: pinned `model: sonnet` triggers "restricted by your organization" fallbackPossibly taken @jcpoyser claimed this 9 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
openai/codex-plugin-cc#804 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/codex-plugin-cc#798 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openai/codex-plugin-cc#794 ·
-
task hangs forever at "Starting Codex task thread." — shorten() splits a UTF-16 surrogate pair in the thread name, app-server drops thread/name/set without replyingPossibly taken @SammyTourani claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/codex-plugin-cc#793 ·
All issues in openai/codex-plugin-cc
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
[scanner] check:spelling skips blog/ — posts and author metadata are never spell-checkedPossibly taken @hivecommons-hive claimed this today. Openagent/scanner bug hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31
Difficulty 1/5 Under an hour Newbie friendliness 72/100
cncf/endusers#1452 · 1 comment ·
Maintainers usually reply within 1 day
-
Edit: HTVKey.vnOpenchannels:edit check:passed
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 6 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MatAtBread/matbot#95 ·
Maintainers usually reply within 1 day
-
Status: Pending Review Type: Feature Request
Difficulty 1/5 Under an hour Newbie friendliness 82/100
OpenRefine/OpenRefine#8019 ·
Maintainers usually reply within 1 day