Skip to content

fix(team): prevent default limit and worker recursion deadlocks - #184

Merged
terisuke merged 25 commits into
devfrom
fix/team-limit-default-deadlock
Apr 25, 2026
Merged

fix(team): prevent default limit and worker recursion deadlocks#184
terisuke merged 25 commits into
devfrom
fix/team-limit-default-deadlock

Conversation

@terisuke

@terisuketerisuke commented Apr 25, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#185

Type of change

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

What does this PR do?

This PR fixes two guardrail team orchestration failures.

First, it defaults strategy and limit inside team.execute(). The runtime tool args can omit schema defaults, and an omitted limit made the scheduler slice ready tasks with NaN, launching zero workers and reporting a false dependency deadlock.

Second, it makes team/background workers non-recursive. Worker sessions now receive explicit rules not to stop after a progress-only response, and their team, background, team_status, and task tools are disabled while normal edit/write tools remain available for write workers.

This branch also includes the latest upstream/dev merge before the fix.

How did you verify your code works?

  • bun test test/plugin/team.test.ts --timeout 30000
  • bun run typecheck
  • bunx prettier --check packages/guardrails/profile/plugins/team.ts packages/opencode/test/plugin/team.test.ts
  • git diff --check
  • pre-push hook: bun turbo typecheck

Screenshots / recordings

N/A

Checklist

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

fwangand others added 24 commits April 24, 2026 14:05
…t landed (anomalyco#19937)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com>
Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com>
CopilotAI review requested due to automatic review settings April 25, 2026 04:57
@github-actions

Copy link
Copy Markdown

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.

CopilotAI 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 merges upstream changes and hardens orchestration and server tooling to prevent team worker deadlocks (missing default limits + recursive tool calls), while also expanding/standardizing the experimental HttpApi bridge and updating related docs/tooling.

Changes:

  • Fix team tool scheduling by defaulting strategy/limit at execute-time and disabling recursive orchestration tools inside workers; add regression tests.
  • Refactor experimental HttpApi auth into a shared middleware/layer (Basic + auth_token) and add bridge-level tests.
  • Misc upstream updates: LSP improvements (C# script + Razor), ripgrep schema migration, beta automation script tweaks, and Zen docs/model/pricing updates.

Reviewed changes

Copilot reviewed 48 out of 49 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
script/github/close-issues.tsAdjust GitHub issue close reason to not_planned.
script/beta.tsAdd grouped logging + deterministic validate/commit smoke flow before beta force-push.
packages/web/src/content/docs/zen.mdxAdd GPT 5.5/GPT 5.5 Pro entries + update pricing/example.
packages/web/src/content/docs/zh-cn/zen.mdxSame Zen doc updates (zh-CN).
packages/web/src/content/docs/zh-tw/zen.mdxSame Zen doc updates (zh-TW).
packages/web/src/content/docs/tr/zen.mdxSame Zen doc updates (TR).
packages/web/src/content/docs/th/zen.mdxSame Zen doc updates (TH).
packages/web/src/content/docs/ru/zen.mdxSame Zen doc updates (RU).
packages/web/src/content/docs/pt-br/zen.mdxSame Zen doc updates (pt-BR).
packages/web/src/content/docs/pl/zen.mdxSame Zen doc updates (PL).
packages/web/src/content/docs/nb/zen.mdxSame Zen doc updates (NB).
packages/web/src/content/docs/ko/zen.mdxSame Zen doc updates (KO).
packages/web/src/content/docs/ja/zen.mdxSame Zen doc updates (JA).
packages/web/src/content/docs/it/zen.mdxSame Zen doc updates (IT).
packages/web/src/content/docs/fr/zen.mdxSame Zen doc updates (FR).
packages/web/src/content/docs/es/zen.mdxSame Zen doc updates (ES).
packages/web/src/content/docs/de/zen.mdxSame Zen doc updates (DE).
packages/web/src/content/docs/da/zen.mdxSame Zen doc updates (DA).
packages/web/src/content/docs/bs/zen.mdxSame Zen doc updates (BS).
packages/web/src/content/docs/ar/zen.mdxSame Zen doc updates (AR).
packages/web/src/content/docs/lsp.mdxDocument C# .csx + new Razor LSP support.
packages/opencode/test/server/httpapi-bridge.test.tsAdd bridge-level tests for HttpApi auth + instance selection.
packages/opencode/test/plugin/team.test.tsAdd regressions for omitted limit + recursive tool disabling.
packages/opencode/src/tool/bash.txtClarify safe git commit --amend conditions.
packages/opencode/src/server/routes/instance/pty.tsSwitch PTY ID parsing to Effect Schema decoder.
packages/opencode/src/server/routes/instance/httpapi/auth.tsIntroduce shared Authorization middleware (Basic + auth_token).
packages/opencode/src/server/routes/instance/httpapi/server.tsCompose HttpApi groups with authorizationLayer and instance middleware.
packages/opencode/src/server/routes/instance/httpapi/config.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/file.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/mcp.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/permission.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/project.tsAttach Authorization + source project from InstanceState context.
packages/opencode/src/server/routes/instance/httpapi/provider.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/question.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/httpapi/workspace.tsAttach Authorization middleware at the group level.
packages/opencode/src/server/routes/instance/file.tsUpdate OpenAPI schema to new ripgrep match DTO.
packages/opencode/src/plugin/codex.tsOverride GPT 5.5 limits for codex plan handling.
packages/opencode/src/lsp/server.tsAdd Razor LSP + refactor Roslyn language server install/lookup.
packages/opencode/src/lsp/language.tsMap .csx extension to C# language.
packages/opencode/src/file/ripgrep.tsMigrate ripgrep JSON parsing to Effect Schema (+ derived Zod statics).
packages/opencode/src/control-plane/adaptors/worktree.tsReplace Zod parsing with Effect Schema decoding.
packages/opencode/src/cli/cmd/import.tsReplace message/part Zod parsing with Effect Schema decoding.
packages/opencode/src/acp/agent.tsSwitch todowrite parsing from Zod to Effect Schema result decode.
packages/opencode/specs/effect/http-api.mdRewrite HttpApi migration spec to current plan/status.
packages/opencode/package.jsonAdd prettier devDependency entry.
packages/guardrails/profile/plugins/team.tsDefault limit/strategy at execute time + disable recursive orchestration tools inside workers.
nix/hashes.jsonUpdate Nix nodeModules hashes.
bun.lockLockfile update (prettier).
.github/VOUCHED.tdUpdate vouch list entry.

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

Comment threadscript/beta.ts
Comment on lines +60 to +69
function group(title: string) {
if (process.env.GITHUB_ACTIONS !== "true") {
console.log(title)
return { [Symbol.dispose]() {} }
}
console.log(`::group::${title}`)
return {
[Symbol.dispose]() {
console.log("::endgroup::")
},

CopilotAIApr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

::group::... workflow commands require escaping %, \r, and \n in the message. Since title includes PR titles, an unexpected newline or % can break log grouping or inject additional workflow commands. Consider sanitizing title (e.g., replace %%25, \r%0D, \n%0A) before logging it in GitHub Actions mode.

Copilot uses AI. Check for mistakes.
@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@terisuke
terisuke merged commit 2cbe327 into devApr 25, 2026
2 of 9 checks passed
@terisuke
terisuke deleted the fix/team-limit-default-deadlock branch April 25, 2026 05:13
Sign up for freeto 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.

team/background workers deadlock or stop before edits

8 participants

@terisuke@fwang@kitlangton@rekram1-node@altendky@Hona@b0o