fix(agent-core): preserve empty prompt arguments#96405
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 4:23 AM ET / 08:23 UTC. Summary PR surface: Source +5, Tests +11. Total +16 across 2 files. Reproducibility: yes. at source level: current main and v2026.6.10 only push non-empty Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one shared parser path that preserves quoted empty tokens; if the apostrophe parser PR also lands, it should carry this invariant and regression coverage forward. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main and v2026.6.10 only push non-empty Is this the best way to solve the issue? Yes. Separating token presence from accumulated text is the narrow shared-parser fix; the main alternative is to fold the same invariant into #90468 if maintainers prefer one parser grammar change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 770b19f496c1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +11. Total +16 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
0202948 to
37840d4
Compare
|
Merged via squash.
|
What Problem This Solves
Prompt template command arguments silently dropped quoted empty values (
""/''). That shifted positional placeholders after the empty argument, so a template using$1,$2,$3could substitute the third shell token into$2instead of preserving the intended blank value.Why This Change Was Made
The parser previously used
currentas both the accumulated value and the token-presence flag. Empty quoted strings are valid arguments, but their accumulated value is intentionally empty, so they were indistinguishable from whitespace-only gaps.This patch tracks whether the parser is currently inside a real token separately from the token text, preserving empty quoted arguments while leaving whitespace collapsing unchanged.
User Impact
Prompt templates can now intentionally pass blank positional arguments without corrupting later argument positions.
Evidence
Real behavior proof added in
packages/agent-core/src/harness/prompt-template-arguments.test.ts:Validation run from this branch:
git diff --checkproduced no output.AI-assisted: OpenAI Codex helped identify the parser edge case and prepare the focused regression test.
Follow-up Evidence After Review
The review asked for stronger real behavior proof beyond the regression assertions. I ran the parser/substitution helpers directly from this branch:
This shows both quoted-empty forms preserve the blank second positional argument, so
$3remains aligned withthirdinstead of shifting into$2.