Repository navigation
harness: pass the system prompt to pi as a file, not an argument - #20
Merged
Merged
Conversation
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>
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 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-promptreads the file when given a path that exists (resolvePromptInput, pi 0.99.2). The harness already writessystem.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 thePROMPT_ON_STDINcomment 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 onetext(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-agentand had left an emptyauth.jsonthere. It's unrelated to this change; CI starts clean.🤖 Generated with Claude Code