Skip to content

fix(core): defer unknown action validation to task building - #2702

Merged
yuyutaotao merged 1 commit into
mainfrom
zzy/fix-find-action-throw
Jun 23, 2026
Merged

yuyutaotao merged 1 commit into
mainfrom
zzy/fix-find-action-throw

Conversation

@EAGzzyCSL

Copy link
Copy Markdown
Collaborator

No description provided.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Deploying midscene with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 TaskBuilder via a shared findActionInActionSpaceOrThrow helper (with a clearer error message that includes available actions).
  • Add a unit test asserting TaskBuilder.build() rejects plans whose type is outside the current actionSpace.
  • 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
yuyutaotao merged commit b69809b into main Jun 23, 2026
7 checks passed
@yuyutaotao
yuyutaotao deleted the zzy/fix-find-action-throw branch June 23, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants