Skip to content

fix(files): guide retries after consumed edit intents - #6797

Open
j15z wants to merge 1 commit into
stagingfrom
feat/opinionated-file-gen-templates
Open

fix(files): guide retries after consumed edit intents#6797
j15z wants to merge 1 commit into
stagingfrom
feat/opinionated-file-gen-templates

Conversation

@j15z

@j15z j15z commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

edit_content consumes its one-shot workspace_file intent before it compiles or applies an edit. When later validation, compilation, or persistence failed, the agent received the immediate error but no instruction that retrying edit_content alone could never work.

Every failure after intent consumption now tells the agent to call workspace_file again before retrying. The existing first-use guidance remains unchanged when no intent was consumed.

Companion: simstudioai/mothership#438

Type of Change

  • Bug fix

Testing

  • cd apps/sim && bun x vitest run lib/copilot/tools/server/files/edit-content.test.ts — 5 tests passed.
  • Regression coverage includes validation failures, compilation errors, thrown edit failures, and the no-intent path.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Not applicable; this changes server-tool recovery guidance and tests only.

@j15z
j15z requested a review from a team as a code owner August 18, 2026 00:11
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 18, 2026 12:23am

Request Review

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Copilot tool error-message and test changes only; no auth, persistence, or intent-consumption logic changes beyond what agents read on failure.

Overview
When edit_content fails after it has already consumed a one-shot workspace_file intent (patch validation, PDF/doc compilation, or persistence errors), failure responses now append explicit recovery text: call workspace_file again before retrying edit_content.

A shared consumedFileIntentFailure helper centralizes that wording across patch, compile, and catch paths. The no intent case still returns the original first-use message (call workspace_file first, do not batch with edit_content).

Tests cover missing patch metadata, compile failures, thrown errors, and the unchanged no-intent path.

Reviewed by Cursor Bugbot for commit fb7b2b8. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Aug 18, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • simstudioai/mothership#438OPEN, not merged (targets staging) — feat(file-agent): add opinionated document design systems

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR improves edit_content failure responses so the agent knows that a consumed one-shot file intent must be recreated before retrying.

  • Centralizes consumed-intent retry guidance across patch validation, compilation, persistence, and thrown failures.
  • Preserves the existing first-use guidance when no intent was consumed.
  • Adds focused regression coverage for validation, compilation, exception, and no-intent paths.
  • Refreshes terminal-protocol workspace metadata in bun.lock.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The recovery suffix is applied only after successful intent consumption, pre-consumption guidance remains unchanged, and the lockfile metadata aligns with the workspace manifest.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/server/files/edit-content.ts Consistently appends accurate recovery guidance to failures occurring after the one-shot file intent has been consumed.
apps/sim/lib/copilot/tools/server/files/edit-content.test.ts Adds targeted coverage for consumed-intent validation and compilation failures, thrown errors, and the unchanged no-intent response.
bun.lock Refreshes valid Bun lockfile metadata to match the existing terminal-protocol package manifest.

Reviews (1): Last reviewed commit: "chore(deps): refresh workspace lockfile" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant