Skip to content

Conversation

noencke
Copy link
Contributor

@noencke noencke commented Oct 13, 2025

Currently, successful edits following a failed edit (e.g. an edit that throws a runtime error) are rolled back. Instead, if a subsequent edit succeeds, we should commit it.

@noencke noencke requested review from Copilot and taylorsw04 October 13, 2025 23:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a rollback bug in the tree-agent where successful edits following a failed edit were incorrectly rolled back. The fix ensures that only the final edit result determines whether to commit or rollback all edits in a query.

  • Updated the rollback logic to only consider the last edit's success status
  • Added comprehensive tests to verify the fix for both scenarios
  • Improved API documentation to clarify the edit behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/framework/tree-agent/src/agent.ts Fixed rollback logic by replacing cumulative failure tracking with last-edit-only tracking
packages/framework/tree-agent/src/test/agent.spec.ts Added tests for both rollback scenarios and updated existing test name
packages/framework/tree-agent/src/api.ts Enhanced documentation for EditResult interface and edit method behavior
packages/framework/tree-agent/api-report/tree-agent.alpha.api.md Removed undocumented comment from API report

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels Oct 13, 2025
this.options?.logger,
);

editFailed ||= editResult.type !== "success";
Copy link
Contributor Author

@noencke noencke Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the || is the key change here. Admittedly, this policy is arbitrary (rollback if and only if final edit was failure), but it seems sensible enough. Probably the most robust way to do it is to give the Model a "commit()" and "reject()" callback in addition to the edit() callback. If they call either, we close the edit window and do as they say, otherwise we fall back to this policy. Something for a future PR, perhaps.

@noencke noencke enabled auto-merge (squash) October 14, 2025 00:51
@noencke noencke disabled auto-merge October 14, 2025 15:38
Copy link
Contributor

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

 ELIFECYCLE  Command failed with exit code 1.

@noencke noencke merged commit 7c9c87b into microsoft:main Oct 14, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants