fix(lint): reject non-MemberExpression colinear under resolvedType#50
Merged
Conversation
A reasoning action whose colinear value is a bare identifier, string literal, ellipsis, or lone @namespace silently bypassed the `resolvedType('invocationTarget')` check because the validator gated on `node instanceof MemberExpression`. The compiler then fell back to `target = name`, producing a tool that reaches Preview / Agentforce runtime but resolves to no implementation when invoked. Extend the constraint validator so any non-MemberExpression colinear under a `resolvedType` constraint emits a `constraint-resolved-type` Error pointing the author at the expected `@namespace.member` shape. The fix participates in the existing `validatedRefs` side channel so `undefined-reference` does not double-report. Adds four colocated tests covering bare identifier, string literal, ellipsis, and lone `@utils` cases in the existing `resolvedType constraint` describe block.
setu4993
approved these changes
Jun 4, 2026
setu4993
left a comment
Member
There was a problem hiding this comment.
Looks good, see tiny request inline.
| node, | ||
| lintDiagnostic( | ||
| range, | ||
| `'${fieldName}' must be an @namespace.member ${label} (e.g. @actions.X). Got ${kind}.`, |
Member
There was a problem hiding this comment.
We can afford to be more explicit here about what is supported vs. not. I think @namespace is a bit too abstract.
Suggested change
| `'${fieldName}' must be an @namespace.member ${label} (e.g. @actions.X). Got ${kind}.`, | |
| `'${fieldName}' must be a member of @utils, @actions, @subagent or @connected_subagent. Got ${kind}.`, |
Contributor
Author
There was a problem hiding this comment.
Took the suggestion and went one step further so it stays correct across dialects: enumerate from ctx.invocationTargetNamespaces (drop aliases) plus @utils from globalScopes. agentscript now produces exactly your suggested list; agentforce/agentfabric produce their own correct lists.
Per review feedback, replace the abstract "@namespace.member" wording with the concrete list of namespaces the active dialect accepts. Pull from ctx.invocationTargetNamespaces, drop aliases, and include @utils when the dialect ships it. Output by dialect: - agentscript: @actions, @connected_subagent, @subagent, @utils - agentforce: @actions, @connected_subagent, @response_formats, @subagent, @topic, @utils - agentfabric: @actions
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.
Summary
A reasoning action whose colinear value is a bare identifier, string literal, ellipsis, or lone
@namespacesilently bypassed theresolvedType('invocationTarget')check. The compiler then fell back totarget = name, producing a tool that reaches Preview / Agentforce runtime but resolves to no implementation when invoked. Customers saw a clean editor and broken behavior in Preview, with no signal pointing them at the typo.This PR extends the constraint validator at
packages/language/src/lint/constraint-validation.tsso any non-MemberExpressioncolinear under aresolvedTypeconstraint emits aconstraint-resolved-typeError pointing the author at the expected@namespace.membershape. The fix participates in the existingvalidatedRefsside channel soundefined-referencedoes not double-report.Adds four colocated tests (bare identifier, string literal, ellipsis, lone
@utils) to the existingresolvedType constraintdescribe block.Test plan
resolvedType constrainthappy-path tests stay green.pnpm --filter @agentscript/agentscript-dialect test— 1108/1108.pnpm --filter @agentscript/language test— 170/170.pnpm --filter @agentscript/agentforce test— 300/300.pnpm --filter @agentscript/agentforce-dialect test— 282/282.pnpm --filter @agentscript/agentfabric-dialect test— 54/54.pnpm --filter @agentscript/compiler test— 801/801.2 0on the bare-identifier repro; hover text reads'value' must be an @namespace.member invocation target (e.g. @actions.X). Got Identifier.ERROR[constraint-resolved-type]diagnostics on the repro and zero false positives on@utils.setVariables/@actions.X/@subagent.X/@connected_subagent.X.