fix(sessions): pass task as a file, not a giant env var — unbreak the consolidator (v0.265.2)#463
Merged
Merged
Conversation
… consolidator + any large-prompt run (v0.265.2)
LocalSessionBackend inlines every launch env var onto the `tmux new-session`
command line, and tmux hard-caps that command at ~16KB ("command too long").
The consolidator embeds up to 40 episodes/lessons in its task (18–46KB); base64'd
into TASK_B64 it overflowed the cap, so new-session failed silently — no pane, no
transcript, no .log — and the liveness sweep flipped the never-launched row to
`crashed` (~11s, turns=null). Fleet-wide, every headless consolidator run crashed;
only the one small-task run had ever succeeded. Any chat/automation run with a
prompt over ~10KB hit the same wall.
Fix: the task rides as a file (TASK_FILE) like mcp.json/company.md already do, so
the command line stays tiny regardless of task size. claude-launch.sh reads
TASK_FILE and falls back to TASK_B64 for pre-existing resume envs. The uid-isolation
launcher writes the task into the member home and sets TASK_FILE too.
Verified: tmux new-session now succeeds with a 46KB task (previously failed >~16KB);
the real claude-launch.sh UNATTENDED lane reads a 20KB task from TASK_FILE and claude
launches + ingests it (transcript written). typecheck + build + 102/102 governance.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVfxDWBcQLbAqJPshB4Ha2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The
consolidator(memory gardener) crashed at launch on every tenant — instapods, instawp, expresstech alike (5/5, 6/6, 4/4 over the last week). Each died ~11s in,turns=null, wrote its.company.md/.mcp.jsonbut no transcript and no.log. The consolidation half of the self-learning loop has been silently dead while the Insights UI still read "Reflect ran" (the watermark advances at kickoff).Root cause
LocalSessionBackend.spawnputs every launch env var on thetmux new-sessioncommand line, and tmux hard-caps that command at ~16KB — over it,new-sessionfails withcommand too long. The consolidator embeds up to 40 recent episodes/lessons in its task (18–46KB); base64'd intoTASK_B64it overflowed the cap, sonew-sessionfailed silently: no pane was ever created → no transcript, no.log→ the liveness sweep flipped the never-launchedrunningrow tocrashed.The one consolidator run that ever succeeded had an 8KB task. Confirmed empirically:
new-sessionsucceeds at an 8KB inline env, fails at ≥20KB (command too long). Any chat/automation run with a prompt over ~10KB hit the same wall.The uid-isolation launcher was never affected (it passes env via
systemd-run --setenv, a 1MB ARG_MAX), which is why this only bit the local-mode fleet.Fix
The task now rides as a file (
TASK_FILE) — exactly likemcp.json/company.mdalready do — instead of a giant inline env var, keeping thenew-sessioncommand line tiny regardless of task size:launchClaudeCodewritessession-<id>.task, setsTASK_FILE, and dropsTASK_B64from the launch env.claude-launch.shreadsTASK_FILE, falling back toTASK_B64for pre-existing resume envs.TASK_FILEtoo.Verification
tmux new-sessionnow succeeds with a 46KB task (old inline path failed >~16KB).claude-launch.shUNATTENDED lane reads a 20KB task fromTASK_FILE; claude launches and ingests the full prompt (transcript written) — previously no pane/transcript ever formed.npm run typecheck+npm run build+ 102/102 governance conformance.🤖 Generated with Claude Code