SIGN IN SIGN UP

fix(harness-opencode): support host tools in subagents (#19645)

## Background

The OpenCode event subscription includes events from both the parent
session and sessions created by its task tool. The bridge currently
discards every event whose session ID differs from the parent. As a
result, task-linked subagents cannot use host tools: their
model-authorized tool event is discarded, so the short-lived relay
authorization is never registered and the MCP call returns `401
unauthorized tool relay request`. Permission requests from those
children are discarded as well, which can leave built-in tools such as
`webfetch` waiting indefinitely.

## Summary

- Track child sessions from OpenCode's task-tool metadata, validating
each child against the session that launched it.
- Process descendant events with isolated translation state so host tool
calls are authorized without mixing child output or lifecycle events
into the parent stream.
- Reply to descendant permission requests using the descendant session
ID.
- Continue ignoring unrelated sessions.
- Add a regression test covering linked-child authorization, child
permissions, and unrelated-session isolation.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

Fixes #19646.
R
Rilton Franzone committed
eccb89e89142db94d4714cda46e9214db0658083
Parent: 20312d6
Committed by GitHub <noreply@github.com> on 8/26/2026, 7:57:19 PM