Skip to content

Pass file-based script metadata to the script runner#530

Open
PratikDhanave wants to merge 3 commits into
microsoft:mainfrom
PratikDhanave:fix-fsskills-script-metadata
Open

Pass file-based script metadata to the script runner#530
PratikDhanave wants to merge 3 commits into
microsoft:mainfrom
PratikDhanave:fix-fsskills-script-metadata

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

Problem

fsskills file-based scripts hand the user-provided ScriptRunner a stripped *Script. In newScript (source.go):

script := &skills.Script{Name: name}
return runner(ctx, owner, script, arguments)

But the discovered Script returned by newScript carries more:

ParametersSchema: defaultFileScriptSchema,
AdditionalProperties: map[string]any{"fsskills.scriptFS": fsys},

So a ScriptRunner that inspects script.ParametersSchema or script.AdditionalProperties["fsskills.scriptFS"] (the script's backing fs.FS, e.g. to open and execute the file) receives empty values. The ScriptRunner signature deliberately passes a *Script rather than just a name, so runners are entitled to that metadata.

The in-tree subprocess runner only uses script.Name + the skill's root FS, so nothing broke — which is exactly why the contract violation went unnoticed.

Fix

Populate the runner-facing Script with the same ParametersSchema and AdditionalProperties (sharing the single additionalProperties map) as the discovered Script.

Test

TestFileSource_Runner_ReceivesScriptMetadata (black-box, in source_script_test.go) uses a runner that captures the received script and asserts ParametersSchema is non-empty and the fsskills.scriptFS entry is present. Fails on main (empty schema, missing key), passes with the fix.

newScript's Run closure handed the user-provided ScriptRunner a bare
&Script{Name: name}, discarding the ParametersSchema and the
AdditionalProperties (notably fsskills.scriptFS, the script's backing
fs.FS) that the discovered Script exposes. A runner that inspects those
fields to locate or execute the file received empty values; only runners
that rely solely on the name and the skill's root FS were unaffected,
which is why it went unnoticed.

Populate the runner-facing Script with the same metadata as the
discovered Script. Adds a black-box test asserting the runner receives
the schema and the scriptFS entry.
Copilot AI review requested due to automatic review settings July 17, 2026 18:59
@PratikDhanave
PratikDhanave requested a review from a team as a code owner July 17, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown

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 contract issue in the fsskills file-based script implementation where the ScriptRunner was being invoked with a stripped *skills.Script (name only), preventing runners from accessing discovered script metadata (notably ParametersSchema and AdditionalProperties["fsskills.scriptFS"]) needed to locate/execute the underlying file.

Changes:

  • Populate the runner-facing *skills.Script with the discovered script’s ParametersSchema and AdditionalProperties (including fsskills.scriptFS).
  • Share a single additionalProperties map between the discovered script and the runner-facing script to keep metadata consistent.
  • Add a black-box regression test to verify the runner receives non-empty schema and the backing FS metadata.

Reviewed changes

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

File Description
agent/skills/fsskills/source.go Ensures the ScriptRunner receives a *Script populated with the discovered script’s schema and FS metadata via AdditionalProperties.
agent/skills/fsskills/source_script_test.go Adds a regression test asserting the runner receives ParametersSchema and fsskills.scriptFS in AdditionalProperties.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants