Skip to content

fix(agents-squad): make handoff schema portable - #226

Open
dlynch90 wants to merge 1 commit into
cline:mainfrom
dlynch90:fix/agents-squad-schema-portability
Open

fix(agents-squad): make handoff schema portable#226
dlynch90 wants to merge 1 commit into
cline:mainfrom
dlynch90:fix/agents-squad-schema-portability

Conversation

@dlynch90

@dlynch90 dlynch90 commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • remove regex lookarounds from the model-facing handoff path schema
  • preserve path safety with runtime allowlist, relative-path, and containment validation
  • add a regression detector and run it through the collection validation entrypoint

Why

OpenAI Codex rejects the current properties.path.pattern before generation because JSON Schema regex lookaround is unsupported. The same agents-squad fix shape already exists in cline/cline; this ports it to the separately distributed official plugin collection.

Verification

  • npm run validate
  • git diff --check

Related: cline/cline#12214, cline/cline#12205, cline/cline#11003

Move absolute-path and traversal checks out of the model-facing Zod schema and into runtime validation so OpenAI-compatible providers do not reject the tool list before generation. Add a regression detector with escaped-literal and character-class controls.
Copilot AI lite review requested due to automatic review settings August 9, 2026 20:08

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 updates the agents-squad plugin’s model-facing handoff path schema to avoid JSON Schema regex lookarounds (which some providers reject), while preserving path safety via runtime validation and adding a regression detector that runs during collection validation.

Changes:

  • Replaced lookaround-based schema constraints with runtime allowlist/relative/containment validation for handoff paths.
  • Added a portability regression test to detect Zod regex lookarounds in the plugin source.
  • Extended npm run validate to run the new portability test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
plugins/agents-squad/schema-portability.test.mjs Adds a test that scans the plugin source for Zod regex lookarounds.
plugins/agents-squad/index.ts Implements runtime handoff path validation and removes lookaround regex from the Zod schema.
package.json Runs the new test as part of npm run validate.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +306 to 314
const pathFromHandoffsDir = relative(dir, resolved);
if (
!pathFromHandoffsDir ||
pathFromHandoffsDir === ".." ||
pathFromHandoffsDir.startsWith(`..${sep}`) ||
isAbsolute(pathFromHandoffsDir)
) {
throw new Error(`Handoff path escapes directory: ${relativePath}`);
}
Comment on lines +7 to +8
function containsZodRegexLookaround(source) {
for (const match of source.matchAll(/\.regex\(\s*\//g)) {
Comment thread package.json
Comment on lines 1 to 9
{
"name": "@cline/plugins-collection",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"validate": "node scripts/validate-plugins.mjs"
"validate": "node scripts/validate-plugins.mjs && node --test plugins/agents-squad/schema-portability.test.mjs"
}
}
Comment on lines 438 to 445
const HandoffPathInput = z
.string()
.trim()
.min(1)
.max(240)
.regex(
/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._/-]+$/,
"Use a relative file path with letters, numbers, '.', '_', '-', or '/'.",
.describe(
"Relative file path using letters, numbers, '.', '_', '-', or '/'. Must not be absolute or contain '..' segments.",
);
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