Skip to content

fix: always include background parameter in task tool schema - #45342

Closed
OgPenguu wants to merge 1 commit into
anomalyco:devfrom
OgPenguu:fix/background-subagent-schema
Closed

fix: always include background parameter in task tool schema#45342
OgPenguu wants to merge 1 commit into
anomalyco:devfrom
OgPenguu:fix/background-subagent-schema

Conversation

@OgPenguu

@OgPenguu OgPenguu commented Aug 26, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #45345

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true, the background parameter on the task tool is set to undefined in the schema, making it invisible to agents. They can't discover it and never use background execution.

The fix changes line 366 in packages/opencode/src/tool/task.ts from:

jsonSchema: flags.experimentalBackgroundSubagents
  ? undefined
  : ToolJsonSchema.fromSchema(BaseParameters),

to:

jsonSchema: ToolJsonSchema.fromSchema(Parameters),

This always includes the full parameter schema (which contains background) regardless of the flag. The flag still controls the description hint and execute function behavior, so the feature gating remains intact.

How did you verify your code works?

  • Built the binary with OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
  • Confirmed the background parameter appears in the tool schema (inspected via compiled output)
  • Verified background subagents spawn and return immediately instead of blocking

Screenshots / recordings

N/A - CLI tool, no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true, the jsonSchema
field was set to undefined, hiding the background parameter from the
tool schema. Agents couldn't see the parameter and never used it.

Changed from:
  jsonSchema: flags.experimentalBackgroundSubagents
    ? undefined
    : ToolJsonSchema.fromSchema(BaseParameters)

To:
  jsonSchema: ToolJsonSchema.fromSchema(Parameters)

This always includes the full Parameters schema (which has the background
field) regardless of the experimental flag. The flag still controls the
description hint and the execute function behavior.

Co-authored-by: OpenChamber <noreply@openchamber.dev>
@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 26, 2026
@github-actions github-actions Bot closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Background subagent parameter hidden from tool schema when experimental flag is enabled

1 participant