fix(core): defer unknown action validation to task building - #2702
Merged
Merged
Conversation
Deploying midscene with
|
| Latest commit: |
59a4655
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://11bd0132.midscene.pages.dev |
| Branch Preview URL: | https://zzy-fix-find-action-throw.midscene.pages.dev |
EAGzzyCSL
force-pushed
the
zzy/fix-find-action-throw
branch
from
June 23, 2026 05:03
fac3b7b to
59a4655
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens action validation by ensuring unknown/unsupported planned actions are rejected during task building (rather than being tolerated earlier in planning/normalization flows), and updates unit tests accordingly.
Changes:
- Enforce action-space membership in
TaskBuildervia a sharedfindActionInActionSpaceOrThrowhelper (with a clearer error message that includes available actions). - Add a unit test asserting
TaskBuilder.build()rejects plans whosetypeis outside the currentactionSpace. - Minor refactors/wording updates around locate normalization (including a test description rename).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/tests/unit-test/task-builder.test.ts | Adds coverage for rejecting an action plan whose type is not in the provided actionSpace. |
| packages/core/tests/unit-test/locate-normalization.test.ts | Renames the first test case description for the “unknown action” locate-normalization scenario. |
| packages/core/src/ai-model/workflows/planning/locate-normalization.ts | Small refactor around action-space matching and locate-field discovery. |
| packages/core/src/agent/task-builder.ts | Uses findActionInActionSpaceOrThrow to validate actions at task-build time and simplify locate-field handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+37
to
+39
| const locateFields = actionInActionSpace | ||
| ? findAllMidsceneLocatorField(actionInActionSpace.paramSchema) | ||
| : []; |
|
|
||
| describe('normalizePlanningActionLocateFields', () => { | ||
| it('skips locate normalization when a planned action is not in the action space', () => { | ||
| it('leaves actions unchanged when no action schema is available for locate normalization', () => { |
yuyutaotao
approved these changes
Jun 23, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.