Skip to content

fix(agy): register work_dir as an agy workspace via --add-dir - #585

Merged
omkargaikwad23 merged 4 commits into
mainfrom
fix/agy-cli-work-dir-add-dir
Aug 31, 2026
Merged

fix(agy): register work_dir as an agy workspace via --add-dir#585
omkargaikwad23 merged 4 commits into
mainfrom
fix/agy-cli-work-dir-add-dir

Conversation

@omkargaikwad23

@omkargaikwad23 omkargaikwad23 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

work_dir was only passed to agy as the subprocess cwd. agy uses the cwd
for file reads, but runs its shell and write tools in <appDataDir>/scratch,
so files the agent created never landed in work_dir. Only --add-dir sets
the tool directory.

This passes --add-dir <work_dir> in addition to the cwd, emitted only when
a scenario declares work_dir — the MCP startup probe and existing scenarios
are unaffected. The fake_home cwd fallback is not mirrored into the flag,
since it holds harness internals rather than scenario data.

Only agy needs this. claude_code, codex_cli and gemini_cli honour the
process cwd directly.

Test plan

  • pytest evalbench/test/agy_cli_test.py — 68 passed
  • New test pins the full path: create_command(cwd=...)--add-dir → subprocess cwd
  • The no-work_dir case is covered by existing exact-argv tests, which fail if the flag is
    always emitted
  • Real eval run with work_dir set: the agent's file landed in work_dir and scratch was empty
    (before the fix, the reverse)
  • Multi-turn: turn two still runs in work_dir

The rubric scorer only reads the transcript, so the scenario scored 100%
before and after. The fix was verified on disk.

Setting the subprocess cwd made agy resolve reads against work_dir, but its
shell and write tools still ran in <appDataDir>/scratch, so agent-created
files landed outside the scenario directory. agy tracks the read workspace
and the tool execution directory separately; only --add-dir sets the latter.

The flag is passed only when a scenario declares work_dir, leaving the MCP
startup probe and work_dir-less scenarios unchanged.
test_run_command_argv_shape already asserts exact argv equality for a command
with no work_dir, so it fails if the flag is emitted unconditionally.
…symmetry

Route the test through create_command so the full evaluator path is pinned:
work_dir -> CLICommand.cwd -> --add-dir plus subprocess cwd.

Document why the fake_home cwd fallback is not mirrored into --add-dir.
@omkargaikwad23

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@prernakakkar-google

Copy link
Copy Markdown
Collaborator

Please correct/rephrase the description.

@prernakakkar-google

Copy link
Copy Markdown
Collaborator

/gcbrun

Comment thread evalbench/generators/models/agy_cli.py
Comment thread evalbench/generators/models/agy_cli.py
@omkargaikwad23
omkargaikwad23 merged commit ac855ee into main Aug 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants