Is there any reason we require str replace editor ...
# proj-agent
m
Is there any reason we require str replace editor tool to only accept absolute paths? In cli/local runtime, using relative paths seems more natural
w
IIRC this is just how the models are trained, but not sure
m
That sounds reasonable! I have a problem with this setting. When I use local runtime + a weaker model (gpt4o), it often mistakenly uses “/workspace” as the prefix when I ask it to create a new file, even though my working dir is set to something else. I think it’s because our editor tool’s example uses “/workspace”. A stronger model like gpt-5 doesn’t have this issue
🤔 1
So I am thinking that we probably need to emphasize cwd more in the prompt (i know @straight-sundown-84319 already did some work around this but it doesn’t seem enough); OR refine/modify editor tool’s prompt to use the actual working dir in the example
nod 1
Right now openhands has a chance to fail the simplest task (hello-world) in terminal-bench when gpt4o is used 🫠 because it often outputs to “/workspace” folder
c
Pretty sure we always send it cwd on a command, but yeah
w
I wonder if there's a problem with our prompt hard-coding
/workspace
m
Yeah we send cwd but not in the first system prompt I think?
c
refine editor tool prompt sounds super reasonable
yes… but that’s what Tim solved I think, sending it first time too
Ah
IIRC we sent it in the RecallObs, which we disable for evals?
m
Yes we sent it in recallobs, which I didn’t disable in terminal bench eval
It doesn’t seem enough to gpt-4o
c
Ah well.
m
Okay cool, i guess i can look into refining the tool’s prompt based on the actual working dir
c
alternatively, I wonder if we could hint with a placeholder even for the model, though that might be a bad idea, e.g.
{pwd}/stuff
💭 1
n
I'm running into this problem a lot too ... there's a LOT of assumptions around
/workspace
I think it's overloaded a fair bit... I enumerated out a bunch of envvars that might help separate some concerns ... but before something like that's undertaken, the plumbing would need to exist for some shellbound mechanism, as well as an agentic mechanism, to re-init the variables such that you don't unintentionally create a confused deputy situation wherein one believes one has truthy correct data, but one does not... the 'on-the-fly' reassembly of state coherence is error-prone and contextually expensive (who am I ? where am I? why am I in this handbasket? why is country music blaring? wherre are my pants? )
the four hardest things in tech are • naming things • caching things • off by one errors
m
Interesting, so with https://github.com/All-Hands-AI/OpenHands/pull/10965, now the prompt looks right:
“description”: “Absolute path to file or directory, e.g.
/app/file.py
or
/app
.”
but now agent decides to create “hello.txt” at
/hello.txt
rather than
/app/hello.txt
. Previously it created the file at
/workspace/hello.txt
Okay I couldn’t repro it anymore. Looks like gpt-4o was just stupid for a while. If anyone is interested, here’s the trajectory (where agent wrote to
/hello.txt
given instruction
Create a file called hello.txt with \"Hello, world!\" as the content.
)
n
this PR feels like the wrong way to go about the notion of exposing pathing ...
the AGENT doesn't really know about the mountpoint ... it's likely to specify the wrong path
if ya really wanna go down this path, what you might wanna do is propagate some symlinks into the container as well so as to create the same filesystem pathing constructs inside the container as outside .... that way the location (in cli or in docker) would be the same....
but ¯\_(ツ)_/¯
m
yeah the code around this has become pretty hacky
n
yah
the str_replace editor's pretty jank imo
I'm actually working on a file tiler alternative
coz my system kept shitting the bed trying to use the str_replace tool
but then I hit the 'oh the org repo already exists,issue an hadd to pivot to try n fix that
but feels like you might wanna poke at openhands/runtime/impl/docker/docker_runtime.py