Skip to content

harness: pass the system prompt to pi as a file, not an argument - #20

Merged
elsehow merged 1 commit into
forecastingresearch:mainfrom
elsehow:system-prompt-file
Oct 20, 2026
Merged

elsehow merged 1 commit into
forecastingresearch:mainfrom
elsehow:system-prompt-file

Conversation

@elsehow

@elsehow elsehow commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

The prompt has gone to pi on stdin since forecastingresearch/agent-box#6, because Linux caps one argv argument at 128 KiB. The system prompt still went as --system-prompt <text>, so a long one would fail the same way on Linux. The case that hit it: a survey questionnaire shared across calls as the system prompt so the provider caches it, 314 KB. That run works on macOS (1 MiB ARG_MAX) and would fail on the box.

pi's --system-prompt reads the file when given a path that exists (resolvePromptInput, pi 0.99.2). The harness already writes system.txt, so it now passes that path, made absolute because pi may run in another cwd. What the model sees is unchanged, including for an empty system prompt (pi's default either way).

  • harness.py: pi_command(model, system_file, ...), and the PROMPT_ON_STDIN comment covers both.
  • test_pi_tools.py: end-to-end test with a system prompt past 128 KiB through the real pi. CI is Ubuntu, so this exercises the real limit. The test model's three message lookups are now one text(n, *roles) helper.

Tests: 409 passed locally. One failed, test_pi_is_billed_to_api_keys_only, because live pi runs on this machine share $TMPDIR/fri-forecaster-agent and had left an empty auth.json there. It's unrelated to this change; CI starts clean.

🤖 Generated with Claude Code

Linux caps one argv argument at 128 KiB (MAX_ARG_STRLEN). The prompt moved
to stdin on 2026-10-19 for that reason, but the system prompt still went as
`--system-prompt <text>`. A long system prompt shared across calls, so the
provider caches it (a 314 KB survey questionnaire, 2026-10-20), runs on macOS
and would fail on Linux. pi's `--system-prompt` reads the file when given a
path that exists, so the harness now passes system.txt, which it already
writes, by absolute path.

Adds an end-to-end test with a system prompt past 128 KiB (CI runs on
Ubuntu, so it exercises the real limit) and folds the test model's three
message lookups into one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elsehow
elsehow merged commit 35aedea into forecastingresearch:main Oct 20, 2026
4 checks passed
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