Repository navigation
fix(command): insert $ARGUMENTS contents verbatim - #758
Merged
Ishaan Gangwani (ishaan1124) merged 1 commit intoSep 28, 2026
Conversation
A string replacement expands the replacement patterns inside the text it inserts, so `$$`, `$&`, `$'` and `` $` `` in the arguments a user typed were rewritten: `$$` collapsed to `$`, `$&` came back as the placeholder itself and `$'` dropped everything after it. A function replacement inserts the arguments exactly as typed.
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 27, 2026 18:22
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
Ishaan Gangwani (ishaan1124)
merged commit Sep 28, 2026
4a6d666
into
synthetic-sciences:main
8 of 9 checks passed
3 of 8 tasks
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 does this PR do, and why?
$ARGUMENTSwas substituted with a string replacement inbackend/cli/src/session/prompt.ts:A string replacement expands the replacement patterns inside the text it
inserts, so the arguments a user typed were rewritten before the command ever
reached the model:
$$$$&$ARGUMENTS(the matched placeholder itself)$'With the template
Explain: $ARGUMENTSand the arguments$$alpha + beta$$ with $& and $' kept, the prompt arrived asExplain: $alpha + beta$ with $ARGUMENTS and kept— so a user pasting displaymath into
/planor/goalsilently got inline math, and a literal$&cameback as the placeholder name.
A function replacement inserts the text literally, so the arguments now
reach the model exactly as typed. This is the same defect class as #753, fixed
for
{file:…}config references in ba152a6; this is the$ARGUMENTSinstance.The fix is one line plus a comment recording why the replacer must be a
function, and the new test drives the real command path against a local
OpenAI-compatible provider and asserts on the request body it actually receives.
Linked issue
Fixes #755
How did you verify it?
The new
backend/cli/test/session/command-arguments.test.tsfails onunmodified
3e94875cand passes with this change. On main the assertionreceives:
Commands run:
bun test --timeout 15000 ./test/session/command-arguments.test.ts→ 1 pass(the additional
(fail) (unnamed)is the pre-existing Windows teardown intest/preload.ts, which cannotrmits temp data dir:EBUSY)bun run --cwd backend/cli typecheck→ exit 0git show 3e94875c:backend/cli/src/session/prompt.tsto confirm the pre-fixline for reviewers who want to reproduce the failure without checking out
Pre-existing reds on this Windows checkout, not from this diff — each
reproduced with my change stashed:
bun run format:checkcannot pass here: git materializes the LF blobs asCRLF, so Prettier flags hundreds of untouched files, including
tsconfig.jsonand
turbo.json. I verified my three files are formatted per the repo configwith line endings normalized.
bun run typecheck: backend is clean;@synsci/workspacefails becausefrontend/workspace/src/custom-elements.d.tsis a symlink (mode120000) thatWindows checked out as a text file containing
../../ui/src/custom-elements.d.ts,which TypeScript then parses as source →
TS1128.test/session/command-shell.test.ts("trusted command shell interpolation …")and two
research-commandscases fail on unmodifiedmainhere as well.CI on Linux runs the real
bun run check.Checklist
bun run checkis green (format, typecheck, backend + frontend/ui + SDK tests) — blocked on this Windows checkout by the CRLF and symlink artifacts described above; backend typecheck is clean and the touched test is greenbun run --cwd frontend/workspace buildsucceeds if I touchedfrontend/workspaceorfrontend/ui— not touched./tooling/repo/generate.tswas run and thetooling/sdkoutput committed if I changedbackend/cli/src/server— not touchedfrontend/docs/src/content/openscience/is updated if behavior changed — no doc change needed: this restores the documented meaning of$ARGUMENTSrather than changing how anything is usedpackage.jsonversions and tags are written by the release workflow)installandfrontend/landing/public/installare still byte-identical if I touched either — not touched