Skip to content

[ENG-19421] fix web chat sub-agent spawn authorization - #189

Merged
orswn merged 2 commits into
boonfrom
okka/eng-19421/fix-subagent-scopes
Sep 3, 2026
Merged

orswn merged 2 commits into
boonfrom
okka/eng-19421/fix-subagent-scopes

Conversation

@orswn

@orswn orswn commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where Boon web chat and Google Chat turns could not delegate work to sub-agents. Every sessions_spawn child dispatch from an HTTP plugin route failed with missing scope: operator.write, so long-running work stayed inline and could consume the parent turn budget.

Related: ENG-19421

Why This Change Was Made

The trusted sub-agent lifecycle now dispatches its child agent call with exactly the write scope required by the gateway. Admin lifecycle calls keep their existing admin scope, explicit caller scopes remain authoritative, and unrelated plugin requests remain scope-free and default-denied.

This changes the sub-agent owner path instead of granting write access to HTTP plugin routes.

User Impact

Web chat and Google Chat agents can start sub-agents for long-running work. Slack behavior remains unchanged. This makes the existing fleet delegation preference effective on HTTP plugin channels.

Evidence

  • A real scope-free plugin request context rejects an unpinned agent dispatch with missing scope: operator.write.
  • The same context accepts sessions_spawn through the trusted lifecycle path.
  • The child handler receives exactly operator.write.
  • Admin cleanup remains exactly operator.admin.
  • Unrelated methods remain default-denied.
  • Focused verification: 8 files and 168 tests passed across gateway and agent Vitest shards.
  • Focused oxfmt, oxlint, and git diff --check passed.
  • Independent final review found no remaining findings.
  • Local smoke testing passed all planned runtime scenarios.

Live web chat and Google Chat pilot checks require a release and rollout, so they were not run in this PR.


Summary by cubic

Fixes ENG-19421 so Boon web chat and Google Chat turns can delegate work to sub-agents; sessions_spawn from HTTP plugin routes no longer fails with missing scope: operator.write and long-running work no longer has to run inline.

  • The trusted sub-agent lifecycle now dispatches child agent calls with exactly operator.write; admin lifecycle calls keep operator.admin, and unrelated plugin requests remain scope-free and default-denied.
  • Explicit caller scopes remain authoritative; HTTP plugin routes themselves do not gain write access.
  • Slack behavior is unchanged.
  • Adds regression coverage for spawning from a scope-less plugin-route request, including an in-process dispatch test that exercises the real gateway authorization path.

Written for commit 0251ddd. Summary will update on new commits.

Review in cubic

@orswn
orswn requested a review from a team September 3, 2026 14:30
@claude

claude Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@orswn

orswn commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/cr

@claude

claude Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@gandalfboon gandalfboon Bot 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.

Reviewed the diff + auth boundary + ran the tests locally (52/52 pass).

Fix is targeted and correct:

  • agent method's canonical scope IS operator.write (core-descriptors.ts:203) — the PR pins exactly the minimum required, not admin.
  • forceSyntheticClient + syntheticScopes is the same pre-existing mechanism the codebase already uses for the sessions.delete admin cleanup path (server-plugins.ts:651). This PR extends the pattern to child-agent startup, not a new capability.
  • Explicit caller scopes remain authoritative (params.scopes ?? ...); HTTP plugin routes themselves gain no write access.
  • Regression test subagent-spawn.in-process.test.ts drives the real gateway authorization path (scope-less context rejects unpinned dispatch, accepts pinned spawn) — right shape, right seam.
  • Slack unchanged; Web chat + Google Chat go from broken → working with least-privilege.

Ship it. 🧙

@orswn
orswn enabled auto-merge (squash) September 3, 2026 16:20
@orswn
orswn disabled auto-merge September 3, 2026 16:20
@orswn
orswn enabled auto-merge (squash) September 3, 2026 16:21
@orswn
orswn merged commit 40712b5 into boon Sep 3, 2026
146 checks passed
@orswn
orswn deleted the okka/eng-19421/fix-subagent-scopes branch September 3, 2026 16:32
orswn added a commit that referenced this pull request Sep 8, 2026
…206)

## Release 2026.6.11-boon.38

Ships channel-owned sub-agent completion replies for Boon web chat.

### Contents (merged onto `boon` since boon.37)
- **#205 (ENG-19421)** — a plugin can register a completion owner for its channel; the announce flow hands the sub-agent completion to the owner and falls back to the existing delivery path when none is registered, so other channels are unchanged. `sessions_yield` runs its tool batch sequentially so a `message` send in the same turn is no longer aborted. Carries upstream openclaw#97657 and openclaw#98835 (`reply session initialization conflicted`). Smoke-tested on a local stack; evidence in #205.
- **#202** — plugin-sdk read of the gateway live run count.
- **#201** — internal identifiers removed from the public tree.

### Release prep
- Root version boon.37 → boon.38; `pnpm release:prep` regenerated the lockstep set (211 files) → `[release-preflight] OK`.
- `CHANGELOG.md` `## 2026.6.11-boon.38` section added; `scripts/package-changelog.mjs` extractor returns 2496 packaged bytes.

### After merge
Tag `v2026.6.11-boon.38` → `boon-release.yml`. The fleet is pinned to `boon.36`, so the roll also picks up boon.37 (#189, #194–#198). Gateway roll first (gated `fleet-roll`), then the anychat-boon-web release that pins this tarball.
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.

3 participants