opencode/packages/core
Luke Parker be740a5d01 fix(browser): revoke attach grants left behind by a server that was killed
The attach grant is a stored session rule, but its revoke runs only from the
plugin's finalizer. After SIGKILL, a crash or a stop timeout, the session kept
browser:* and skill:browser allows with no attachment behind them, so the next
server listed the browser tools and every call failed with
[browser.disconnected].

Each grant is now recorded in plugin storage with the server process that wrote
it (host and process ID) and its location, before the grant is written; a
successful revoke removes the record. When the plugin starts for a location, and
before it registers the browser RPC so no attach can race it, it revokes the
grants recorded for that location by a process that no longer runs.

Several server processes can share one database (a desktop's server and a
manual `opencode serve` both use opencode.db), so a sweep of every session in
the location could revoke another server's live grant. The sweep skips records
of a running process and of another host, which cannot be checked. Grants
written before this change have no record and are left alone; the next attach
and detach of their session removes them.

The startup sweep before RPC registration, its location scoping and ignoring
per-session failures come from #61639.

Fixes #61609

Co-authored-by: Chen Yufeiyang <fei76161@gmail.com>
2026-11-13 08:25:22 +10:00
..
perf feat(server): let embedders supply the fetch for OpenCode's HTTP and MCP requests (#61582) 2026-11-04 04:13:45 -06:00
script refactor: run every benchmark with strobe (#60880) 2026-11-03 20:05:16 -06:00
src fix(core): drop stale thinking when Claude Agent prompts or tools change (#63592) 2026-11-12 13:56:50 -06:00
test fix(browser): revoke attach grants left behind by a server that was killed 2026-11-13 08:25:22 +10:00
bunfig.toml refactor(core): simplify integration test fixtures (#33292) 2026-06-22 04:15:34 +00:00
drizzle.config.ts refactor(core): move database schema ownership (#29068) 2026-05-30 21:08:38 -04:00
package.json feat(core): run local Windows shell commands in the process daemon (#63409) 2026-11-11 18:32:15 -05:00
README.md refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
schema.json refactor(core): store background job markers in a SQLite job table (#60491) 2026-10-30 07:50:16 -07:00
tsconfig.build.json feat(core): configure package publishing 2026-08-12 09:30:34 -04:00
tsconfig.json chore: upgrade typecheck to TypeScript 7.0.2 (#56300) 2026-10-17 13:26:46 -07:00
tsconfig.tests.json refactor: run every benchmark with strobe (#60880) 2026-11-03 20:05:16 -06:00

@opencode/core

Core runtime services for OpenCode.