[GEAK] BUG — metrix / profiler-mcp mis-wraps quoted commands → rocprofv3 fails with "unexpected EOF"
- Type: ISSUE (bug)
- Target repo: AMD-AGI/GEAK (profiler/metrix integration —
profiler-mcp / metrix backend)
- Status: PREPARED ON DISK — not filed (gh not authenticated;
origin is a local clone with no writable upstream).
Problem
The metrix profiler backend builds the rocprofv3 command by double-wrapping an already-quoted command. rocprofv3 receives a bash -c '...' string whose inner single quotes are not balanced after wrapping, so the shell aborts with unexpected EOF while looking for matching quote and rocprofv3 exits 2. This is the root cause behind GEAK item #1 (profile collection returning ok=false).
Evidence (hard, on disk)
/home/sapmajum/PROJECTS/geak_mla_out/results/round_5/profile.json (and round_1..4, identical pattern):
rocprofv3 failed with exit code 2
stderr: ... [rocprofv3] 'bash -c '/home/sapmajum/PROJECTS/geak_mla_out/_eval_worktree/run.sh '"'"'cd /home/sapmajum/PROJECTS/geak_mla_out/_eval_worktree && python test_kernel_harness.py --profile'"'"''' :: 0.000000 sec
'"'"'cd: -c: line 1: unexpected EOF while looking for matching `''
'"'"'cd: -c: line 2: syntax error: unexpected end of file
A second variant (source-mirror harness) shows the same failure with a simpler wrap:
[rocprofv3] 'bash -c 'python3 .../examples/mla_decode/test_kernel_harness.py --profile'' :: 0.000000 sec
.../test_kernel_harness.py: -c: line 1: unexpected EOF while looking for matching `''
(see /home/sapmajum/PROJECTS/geak_mla_out/results/round_5/fixed-canonical/traj.json and task_0.log, and /home/sapmajum/PROJECTS/geak_mla_run.log:320,455,594,727,850).
The give-away is the nested '"'"' escaping and the unbalanced trailing '' — the command was quoted once by the harness/run.sh layer and quoted again by the metrix→rocprofv3 wrapper.
Fix (recommended)
- Do not re-quote an already-quoted command. Pass the harness invocation to rocprofv3 as an
argv list (["python3", harness, "--profile"]) instead of a single bash -c '<string>', OR
- Build the
bash -c payload exactly once and use shlex.quote on the unquoted command, never on a string that already contains the '"'"' escapes.
- Add a regression test that profiles a harness whose path/args contain spaces and quotes.
Relationship
Root cause of GEAK #1. Fixing this makes the profile succeed; #1 makes preprocess robust even when any profiler fails.
[GEAK] BUG — metrix / profiler-mcp mis-wraps quoted commands → rocprofv3 fails with "unexpected EOF"
profiler-mcp/ metrix backend)originis a local clone with no writable upstream).Problem
The metrix profiler backend builds the rocprofv3 command by double-wrapping an already-quoted command. rocprofv3 receives a
bash -c '...'string whose inner single quotes are not balanced after wrapping, so the shell aborts withunexpected EOF while looking for matching quoteand rocprofv3 exits 2. This is the root cause behind GEAK item #1 (profile collection returningok=false).Evidence (hard, on disk)
/home/sapmajum/PROJECTS/geak_mla_out/results/round_5/profile.json(and round_1..4, identical pattern):A second variant (source-mirror harness) shows the same failure with a simpler wrap:
(see
/home/sapmajum/PROJECTS/geak_mla_out/results/round_5/fixed-canonical/traj.jsonandtask_0.log, and/home/sapmajum/PROJECTS/geak_mla_run.log:320,455,594,727,850).The give-away is the nested
'"'"'escaping and the unbalanced trailing''— the command was quoted once by the harness/run.sh layer and quoted again by the metrix→rocprofv3 wrapper.Fix (recommended)
argvlist (["python3", harness, "--profile"]) instead of a singlebash -c '<string>', ORbash -cpayload exactly once and useshlex.quoteon the unquoted command, never on a string that already contains the'"'"'escapes.Relationship
Root cause of GEAK #1. Fixing this makes the profile succeed; #1 makes preprocess robust even when any profiler fails.