Skip to content

Fix edit recovery for file_path workspace edits - #81909

Merged
giodl73-repo merged 4 commits into
openclaw:mainfrom
giodl73-repo:fix/edit-file-path-recovery-80066
May 16, 2026
Merged

giodl73-repo merged 4 commits into
openclaw:mainfrom
giodl73-repo:fix/edit-file-path-recovery-80066

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Honor file_path and related edit path aliases in edit-tool recovery, matching the edit tool/display path handling.
  • Add a regression test for AGENTS.md edits where the file changes but a post-write error is thrown.

Fixes #80066.

Real behavior proof

  • Behavior or issue addressed: edit calls that use file_path could successfully update a workspace file such as ~/.openclaw/workspace/AGENTS.md but still surface as Edit failed when a post-write error occurred, because recovery only resolved the path argument.
  • Real environment tested: WSL Ubuntu-24.04 source worktrees created from upstream/main and PR head e6065687169a48a0f7d167a63ddd2468b6319a05.
  • Exact steps or command run after this patch: created clean detached worktrees for upstream/main and fork/fix/edit-file-path-recovery-80066; in each worktree ran pnpm --silent exec tsx ./probe-file-path-edit-recovery.mjs. The probe imported the real wrapEditToolWithRecovery(), created a real temp .openclaw/workspace/AGENTS.md, called the wrapped edit tool with file_path, wrote new content, then simulated a post-write failure.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):

PR #81909 file_path edit recovery before/after proof

Fresh proof artifact: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81909-fresh/pr-81909/pr-81909-file-path-edit-recovery-before-after-proof.png
Proof summary: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81909-fresh/pr-81909/summary.txt

BEFORE upstream/main:
status=0
threw=true
isError=n/a
fileContainsNewInstruction=true
resultText=Simulated post-write failure (e.g. generateDiffString)

AFTER PR #81909 head:
status=0
threw=false
isError=false
fileContainsNewInstruction=true
resultText=Successfully replaced text in /tmp/openclaw-edit-recovery-proof-y32zA2/.openclaw/workspace/AGENTS.md.
  • Observed result after fix: upstream/main writes the file but still throws the simulated post-write failure; the PR head recognizes file_path, detects the changed file, and returns a successful edit result.
  • What was not tested: No live Feishu bot/channel was exercised; this proof directly verifies the runtime edit recovery wrapper path with a real temporary workspace file.

Regression coverage

  • src/agents/pi-tools.read.host-edit-recovery.test.ts covers post-write recovery when edit calls use file_path.

Validation

  • node scripts/test-projects.mjs src/agents/pi-tools.read.host-edit-recovery.test.ts src/agents/pi-tools.workspace-paths.test.ts
  • pnpm check:changed

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Summary
Review failed before ClawSweeper could summarize the requested change.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Real behavior proof
Not applicable: Real behavior proof was not assessed because the Codex review failed.

Next step before merge
Review did not complete, so no work-lane recommendation was made.

Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

Do we have a high-confidence way to reproduce the issue?

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)

Remaining risk / open question:

  • No close action taken because the review did not complete.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 842e6f16437c.

@giodl73-repo
giodl73-repo force-pushed the fix/edit-file-path-recovery-80066 branch 3 times, most recently from 5bbe86e to d684980 Compare May 16, 2026 06:21
@giodl73-repo
giodl73-repo force-pushed the fix/edit-file-path-recovery-80066 branch 3 times, most recently from 8329011 to 666506c Compare May 16, 2026 14:10
giodl73-repo and others added 3 commits May 16, 2026 07:15
Honor file_path and related aliases when resolving edit recovery paths so post-write errors do not surface false edit failures after the file changed.

Co-authored-by: Copilot <[email protected]>
@giodl73-repo
giodl73-repo force-pushed the fix/edit-file-path-recovery-80066 branch from 666506c to e606568 Compare May 16, 2026 14:15
@giodl73-repo

giodl73-repo commented May 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded: this earlier generated screenshot artifact should not be used as proof for #81909.

Use the fresh deterministic before/after proof now embedded in the PR body instead: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81909-fresh/pr-81909/pr-81909-file-path-edit-recovery-before-after-proof.png

@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label May 16, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Updated #81909 with a fresh deterministic proof image and clearer PR body.

The earlier generated screenshot for this PR should be ignored. The new proof compares upstream/main against PR head e6065687169a48a0f7d167a63ddd2468b6319a05 using the real wrapEditToolWithRecovery() export, a real temp .openclaw/workspace/AGENTS.md, file_path params, and a simulated post-write failure:

  • Before: the file changes, but recovery throws the simulated post-write failure.
  • After: recovery recognizes file_path, detects the file changed, and returns success.

Fresh proof image: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81909-fresh/pr-81909/pr-81909-file-path-edit-recovery-before-after-proof.png
Proof summary: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81909-fresh/pr-81909/summary.txt

@giodl73-repo
giodl73-repo merged commit 9e31b9d into openclaw:main May 16, 2026
113 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* Recover edit tool failures for file_path

Honor file_path and related aliases when resolving edit recovery paths so post-write errors do not surface false edit failures after the file changed.

* Refresh checks after proof formatting fix

* Refresh checks after live proof update
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
* Recover edit tool failures for file_path

Honor file_path and related aliases when resolving edit recovery paths so post-write errors do not surface false edit failures after the file changed.

* Refresh checks after proof formatting fix

* Refresh checks after live proof update
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* Recover edit tool failures for file_path

Honor file_path and related aliases when resolving edit recovery paths so post-write errors do not surface false edit failures after the file changed.

* Refresh checks after proof formatting fix

* Refresh checks after live proof update
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* Recover edit tool failures for file_path

Honor file_path and related aliases when resolving edit recovery paths so post-write errors do not surface false edit failures after the file changed.

* Refresh checks after proof formatting fix

* Refresh checks after live proof update
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚠️ 📝 Edit: in workspace/AGENTS.md failed warning appears on every Feishu operation

1 participant