feat(agy): offload large prompts to temp file for agy CLI - #389
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 22, 2026, 6:56 AM ET / 10:56 UTC. ClawSweeper reviewWhat this changesThe PR stores oversized agy prompts in a private temporary file, asks agy to read it through a file URL, then removes the file after the CLI exits. Merge readinessKeep this PR open for a maintainer compatibility decision: it replaces current main’s explicit large-prompt rejection with behavior that relies on agy following a natural-language file URL reference, demonstrated only on agy 1.1.13. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe CLI runner converts generated summarize prompts into provider-specific commands and returns the provider response to the CLI and daemon flows. This change affects the agy command’s large-input path while preserving its normal argv path. flowchart LR
A[Extracted input] --> B[Summarize prompt]
B --> C[agy CLI runner]
C --> D{Fits command limit?}
D -->|Yes| E[Prompt in argv]
D -->|No| F[Private prompt file]
E --> G[agy print mode]
F --> G
G --> H[Summary output]
Decision needed
Why: This is a new default provider capability whose correctness depends on an external CLI’s version-specific prompt interpretation, not solely on local cleanup and argv handling. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Define the supported agy file-input compatibility boundary, then either guard/document that boundary with regression proof or retain the existing explicit rejection for unsupported versions. Do we have a high-confidence way to reproduce the issue? Yes for the current limitation: current main’s agy runner deterministically rejects prompts over its platform argv threshold, though the PR’s new behavior was live-proven only on agy 1.1.13. Is this the best way to solve the issue? Unclear: the temporary-file implementation is narrow and cleanup is covered, but automatic use needs an accepted agy compatibility contract before it replaces the existing explicit error. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c78ac23b2fc8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…nst extraArgs overflow
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Rationale
Using
--cli agy(Antigravity CLI wrapper) triggers an explicit prompt length failure when summarizing large web pages, transcripts, or stdin input because prompts were formatted directly as command-line argv flag arguments (agy --print "<prompt>"), hitting OSARG_MAXbuffer limits (~120 KB on macOS/Linux or Windows command limits).Proposed Solution
Offload prompts exceeding platform argv limits to a secure temporary file and pass a
file://URI reference in--print, mirroring the pattern used by thepiCLI provider (src/llm/cli-runners/pi.ts):src/llm/cli-runners/plain.ts): WhenpromptSize > limit(or Windows command length limit), creates a temporary directory (summarize-agy-prompt-) insideisolatedCwd(if--sandboxis enabled) or systemtmpdir().{ mode: 0o600 }permissions and guarantees recursive deletion of prompt directories infinallyblocks on success, error, or process timeout.docs/cli.md): Updateddocs/cli.mdto document automatic temp file offloading for largeagyprompts.Live Behavior Proof (Real Execution)
Below is the verified terminal execution log running
summarize --cli agyagainst a 342 KB (342,001 character) input file usingagy 1.1.13:Environment & Input
agyversion: 1.1.13/tmp/large-test-input.txt(342,001 characters / 334 KB text payload)summarize --cli agy --plain /tmp/large-test-input.txtTerminal Output
Tests & Quality Gate
tests/llm.cli.agy.test.tscovering temp file offloading,0o600permissions, error cleanup, and sandbox interaction.pnpm -s checkpasses all 3,000+ test suites and meets strict 85% coverage requirements across Statements, Branches, Functions, and Lines.