Repository navigation
fix: raw-grok Windows .cmd argv via RLE_GROK_ARGV_JSON - #60
Merged
Merged
Conversation
cmd.exe re-parses create_subprocess_exec argv and drops large -p prompts, so grok-docker.cmd ticks returned 0 actions. When the binary ends in .cmd/.bat, write a UTF-8 JSON argv sidecar, set RLE_GROK_ARGV_JSON, and invoke the wrapper with no CLI args. Host grok.exe is unchanged. Co-authored-by: Jason <jkbennitt@users.noreply.github.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.
Problem
On Windows,
raw-grokwith--harness-opt binary=.../grok-docker.cmdproduced instant 0-action ticks.cmd.exere-parses argv fromasyncio.create_subprocess_execand drops or mangles a large-pprompt.grok-docker.cmdthen launches PowerShell with empty%*. The image entrypoint defaults tomcp listand exits 0, so Crashlanded ticks report 0 tokens / 0 actions / success.The grok-build docker wrapper already supports a side-channel: when
RLE_GROK_ARGV_JSONis set to a UTF-8 JSON file path (a JSON array of argv strings after the wrapper path),grok-docker.ps1reads that file instead of%*. Hostgrok.exeviacreate_subprocess_execdoes not need this.Change
raw-groknow detects a Windows.cmd/.batbinary (path suffix, includingC:\...\grok-docker.cmd) and:RLE_GROK_ARGV_JSONon the subprocess env (clears any stale value first)cmd.exenever sees the promptHost
grok/grok.exeis unchanged: full argv, no sidecar, inherited env.TURN_RULES/ model-baseline semantics are unchanged. Felix and grok-build product behavior are not modified.How to verify
Unit (no game, mocked subprocess):
Live Windows proof (RimWorld + RIMAPI + docker wrapper):
Expect tokens > 0 and the wrapper to receive
-pplus the full prompt from the JSON sidecar. Hostgrok.exe(no.cmd) should still work withoutRLE_GROK_ARGV_JSON.Contrast (pre-fix):
create_subprocess_exec(grok-docker.cmd, "-p", long_prompt, ...)fails or returns empty; the same wrapper withRLE_GROK_ARGV_JSONwritten returns OK + tokens.