-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: increase tool call limit to 50 and show clear pause message #2828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { | ||
| LocalAgentFixture, | ||
| Turn, | ||
| } from "../../../../testing/fake-llm-server/localAgentTypes"; | ||
|
|
||
| /** | ||
| * Fixture that triggers the step limit by generating 50 tool call turns. | ||
| * The AI SDK's stepCountIs(50) will stop after 50 steps, and the handler | ||
| * will append a <dyad-step-limit> notice to the response. | ||
| */ | ||
| const toolCallTurns: Turn[] = Array.from({ length: 50 }, (_, i) => ({ | ||
| text: `Step ${i + 1}: reading file.`, | ||
| toolCalls: [ | ||
| { | ||
| name: "read_file", | ||
| args: { path: "package.json" }, | ||
| }, | ||
| ], | ||
| })); | ||
|
|
||
| // Final text-only turn (won't be reached because stepCountIs(50) stops first) | ||
| const finalTurn: Turn = { | ||
| text: "All steps completed.", | ||
| }; | ||
|
|
||
| export const fixture: LocalAgentFixture = { | ||
| description: | ||
| "Triggers step limit by making 50+ tool call rounds, causing a pause notification", | ||
| turns: [...toolCallTurns, finalTurn], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { expect } from "@playwright/test"; | ||
| import { Timeout, testSkipIfWindows } from "./helpers/test_helper"; | ||
|
|
||
| /** | ||
| * E2E test for the step limit feature. | ||
| * When the local agent hits 50 tool call steps, it pauses and shows | ||
| * a <dyad-step-limit> notification card. | ||
| */ | ||
|
|
||
| testSkipIfWindows("local-agent - step limit pause", async ({ po }) => { | ||
| await po.setUpDyadPro({ localAgent: true }); | ||
| await po.importApp("minimal"); | ||
| await po.chatActions.selectLocalAgentMode(); | ||
|
|
||
| await po.sendPrompt("tc=local-agent/step-limit"); | ||
|
|
||
| // Verify the step limit card is visible | ||
| await expect( | ||
| po.page.getByText("Paused after 50 tool calls", { exact: true }), | ||
| ).toBeVisible({ | ||
| timeout: Timeout.EXTRA_LONG, | ||
| }); | ||
|
|
||
| // Verify the "Continue" button is shown | ||
| await expect(po.page.getByRole("button", { name: "Continue" })).toBeVisible({ | ||
| timeout: Timeout.MEDIUM, | ||
| }); | ||
|
|
||
| // Click the "Continue" button | ||
| await po.page.getByRole("button", { name: "Continue" }).click(); | ||
|
|
||
| await po.snapshotMessages(); | ||
| }); |
214 changes: 214 additions & 0 deletions
214
e2e-tests/snapshots/local_agent_step_limit.spec.ts_local-agent---step-limit-pause-1.aria.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,214 @@ | ||
| - paragraph: /Generate an AI_RULES\.md file for this app\. Describe the tech stack in 5-\d+ bullet points and describe clear rules about what libraries to use for what\./ | ||
| - button "file1.txt file1.txt Edit": | ||
| - img | ||
| - text: "" | ||
| - button "Edit": | ||
| - img | ||
| - text: "" | ||
| - img | ||
| - paragraph: More EOM | ||
| - button "Copy": | ||
| - img | ||
| - img | ||
| - text: Approved | ||
| - img | ||
| - text: claude-opus-4-5 | ||
| - img | ||
| - text: less than a minute ago | ||
| - img | ||
| - text: (1 files changed) | ||
| - button "Copy Request ID": | ||
| - img | ||
| - text: "" | ||
| - paragraph: tc=local-agent/step-limit | ||
| - paragraph: "Step 1: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 2: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 3: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 4: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 5: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 6: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 7: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 8: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "Step 9: reading file." | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - paragraph: "/Step \\d+: reading file\\./" | ||
| - img | ||
| - text: Read package.json | ||
| - img | ||
| - text: /Paused after \d+ tool calls/ | ||
| - button "Continue": | ||
| - img | ||
| - text: "" | ||
| - text: /Automatically paused after \d+ tool calls\./ | ||
| - button "Copy": | ||
| - img | ||
| - img | ||
| - text: Approved | ||
| - img | ||
| - text: claude-opus-4-5 | ||
| - img | ||
| - text: less than a minute ago | ||
| - button "Copy Request ID": | ||
| - img | ||
| - text: "" | ||
| - paragraph: Continue | ||
| - button "file1.txt file1.txt Edit": | ||
| - img | ||
| - text: "" | ||
| - button "Edit": | ||
| - img | ||
| - text: "" | ||
| - img | ||
| - paragraph: More EOM | ||
| - button "Copy": | ||
| - img | ||
| - img | ||
| - text: claude-opus-4-5 | ||
| - img | ||
| - text: less than a minute ago | ||
| - button "Copy Request ID": | ||
| - img | ||
| - text: "" | ||
| - button "Undo": | ||
| - img | ||
| - text: "" | ||
| - button "Retry": | ||
| - img | ||
| - text: "" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This snapshot is too permissive and does not verify the new 50-call limit. Assert the exact number in the pause text so regressions in the configured threshold are caught.
Prompt for AI agents