Repository navigation
Conversation
Pi reads the prompt from stdin when no positional prompt is given. A chat turn embeds the whole conversation, so once the prompt passes maxArgvPromptBytes keeping it on argv makes fork/exec fail with E2BIG before the CLI starts. SOP turns still use the prompt-file fallback and keep the positional form. Refs Tencent#1081
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.
What changed
A chat turn on the
piagent CLI embeds the whole conversation in the prompt. Once that prompt passesmaxArgvPromptBytes(96 KiB),AgentCLICommandstill appended it as a positional argv argument, sofork/execfailed withE2BIG(argument list too long) before the CLI started; every retry rebuilt the same oversized argv.Pi reads the prompt from stdin when no positional prompt is given. For chat turns with an oversized prompt, this change now leaves argv
prompt-free and setsCommandSpec.Stdininstead. The existing conversation pipeline already forwardsStdinto the native process, so the complete prompt reaches Pi without EOF.SOP turns keep their current positional form: they write the task prompt to a file and
positionalPromptsubstitutes a short reference when it is oversized, so their argv shape is unchanged.Fixes #1081.
Scope
Compatibility
Affected host: any platform/runner running Pi chat (
piagent CLI provider). No API, schema or runner-protocol change. Short chat prompts, resumed sessions, SOP invocations and all other providers keep their existing argv. No migration required.Validation
Commands actually run (Windows host, Linux target; tests executed in WSL Ubuntu 24.04):
New regression tests:
TestAgentCLIPiOversizedChatPromptUsesStdin: the prompt leaves argv, arrives byte-for-byte on stdin.TestAgentCLIPiSOPPromptStaysOnArgv: the SOP path is unchanged.The rest of the
internal/runtimesuite passes apart from 5 environment-related failures outside this diff. Four gate-MCP tests need agobinary in WSL PATH.TestDockerfileBundlesTheOnDemandDeepSeekHarnessReleasefails only because the Windows checkout stores the Dockerfile with CRLF (...dsh@0.2.2-rc.1\r\n), while the assertion expects LF; the Linux CI checkout is LF and this test is untouched by the PR.Not run: repository-level
go test -p=2 ./..., browser acceptance suite, real Pi model/API turn.Safety