opencode/packages/core/test
Ryan Vogel 3d1addb2ac fix(core): ask the webfetch permission for Code Mode fetch calls
The execute (Code Mode) tool exposes a `fetch` global that went straight to
the network. The webfetch tool asks the `webfetch` permission for every URL,
but Code Mode did not, so a `webfetch: deny` rule or a Console "Can't fetch
the web" policy did nothing against a model that used `execute` to send data
to any server.

- core: the tool registry now asserts the `webfetch` permission (resource =
  the URL, same shape as the webfetch tool) in the extension.before hook of
  every fetch a Code Mode program makes. A denied URL throws inside the
  program and its progress row settles as an error. Tool.node now depends on
  Permission.node.
- codemode: extension globals were called before their `extension.before`
  hook ran, so a failing hook only hid the result while the request had
  already been sent. The hook now runs first and a denied call never reaches
  the host function. A denied async global still rejects its promise; any
  other denied global throws.

Verified: new cases in codemode/test/codemode.test.ts (denied host function
is never called) and core/test/tool-execute.test.ts (webfetch deny rule fails
the script's fetch, allow rule lets it through, each URL is asserted) both go
red without the fix. bun typecheck in core and codemode, codemode suite
(1415 pass), core suite (only pre-existing local failures: ripgrep download
and macOS bash 3.2 shell tests, also failing on dev), bun run check.
2026-10-26 14:30:37 -04:00
..
codemode fix(codemode): drop the parameter name from rendered signatures (#50435) 2026-09-21 16:44:46 -05:00
config fix(core): keep codemode on legacy MCP entries (#59126) 2026-10-26 12:38:32 -05:00
effect fix(cli): bound server shutdown with a 10 s deadline (#58817) 2026-10-25 07:47:11 -07:00
filesystem feat(core): watch files open in the side panel (#59081) 2026-10-25 22:54:00 +00:00
fixture fix(core): coordinate credential refreshes across locations and processes (#54023) 2026-10-26 01:09:42 -05:00
fixtures/recordings/session-runner feat(core): let subagents pick a model and expose models tool (#49194) 2026-09-16 01:16:55 -05:00
github-copilot fix(core): accept interleaved Copilot reasoning_opaque values (#54201) 2026-10-09 16:45:57 -05:00
instructions fix(core): drop session ID and order instructions for prompt-cache reuse (#51960) 2026-09-28 19:29:28 -05:00
lib test(core): bound advance by real time instead of steps (#57119) 2026-10-19 16:08:14 +00:00
modal refactor(core): refactor model resolving logic, fix missing variant logic (#48943) 2026-09-14 18:29:34 -05:00
plugin fix(core): use Vertex multi-region hosts for eu and us (#59335) 2026-10-26 12:38:13 -05:00
process chore(ci): speed up and stabilize the test workflow (#55866) 2026-10-16 00:35:49 +02:00
pty feat(server): add client MCP websocket endpoint (experimental) (#57505) 2026-10-22 15:56:44 -04:00
shell-scan fix(core): make the portable PowerShell scanner sound against real pwsh (#53404) 2026-10-05 14:07:15 -07:00
skill fix(core): send only changed entries in instruction updates (#57626) 2026-10-20 23:09:10 -05:00
util refactor(core): resolve real git binary once on macOS (#58602) 2026-10-23 21:11:12 -07:00
agent.test.ts feat(core): stop asking for external directory access by default (#53585) 2026-10-06 15:52:23 -04:00
aisdk-native.test.ts fix(core): load and spell reasoning for every native provider package (#55789) 2026-10-15 15:34:08 -05:00
aisdk.test.ts refactor(ai): replace wildcard exports with an explicit public API (#59183) 2026-10-26 09:37:24 -05:00
app.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
boot-work.test.ts test(core): guard boot work counts for catalog lookups, Azure clones and git spawns (#58892) 2026-10-25 15:50:56 -07:00
browser-idle.test.ts fix(core): keep locations with running sessions or background jobs (#57416) 2026-10-20 11:36:08 -04:00
bus-session-routing.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
bus-unpersisted.test.ts perf(core): skip encoding durable event payloads that aren't persisted (#58923) 2026-10-25 06:16:09 -07:00
bus.test.ts refactor: v2.1 minor breaking changes (#57260) 2026-10-20 00:42:13 -05:00
catalog.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
codemode.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
command.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
credential-lock.test.ts fix(core): coordinate credential refreshes across locations and processes (#54023) 2026-10-26 01:09:42 -05:00
credential.test.ts refactor: v2.1 minor breaking changes (#57260) 2026-10-20 00:42:13 -05:00
database-drizzle.test.ts chore(core): redact params in database query errors (#55621) 2026-10-15 01:04:07 -05:00
database-migration.test.ts refactor(core): drop unused session_pending table and pin the history compaction bound (#59020) 2026-10-25 14:27:59 -07:00
database.test.ts fix(core): restrict database files to their owner (#52150) 2026-09-29 14:18:40 -05:00
effect-app-node-platform.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
effect-simplification-types.test.ts chore: enforce effect simplifications (#43979) 2026-08-21 19:48:27 +00:00
environment.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
event-logger.test.ts refactor(core): split provider and model registries (#48901) 2026-09-14 10:34:11 -04:00
file-access-path.test.ts refactor(core): folder-permission checks use the project's own file system (#59089) 2026-10-26 10:23:18 -07:00
file-access.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
file-mutation.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
form.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
formatter.test.ts fix(core): merge formatter config across files (#52739) 2026-10-02 17:49:12 +05:30
generate.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
git.test.ts perf(core): cache git discovery in Project.resolve by metadata fingerprint (#58616) 2026-10-24 14:34:07 -07:00
image-photon.test.ts perf(core): resize images in a worker and release photon memory when idle (#58820) 2026-10-25 22:28:48 -07:00
instance-vanilla.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
instruction-discovery.test.ts fix(core): match absolute instruction globs across directories (#58749) 2026-10-24 12:42:49 -05:00
instruction-state.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
integration-refresh.test.ts fix(core): coordinate credential refreshes across locations and processes (#54023) 2026-10-26 01:09:42 -05:00
integration.test.ts fix(core): coordinate credential refreshes across locations and processes (#54023) 2026-10-26 01:09:42 -05:00
job.test.ts refactor(core): require job ids from their subject (#52806) 2026-10-02 18:27:13 +00:00
kv.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
location-activity.test.ts fix(core): canonicalize location in activity tracking (#59087) 2026-10-25 23:03:25 +00:00
location-filesystem.test.ts feat(session-ui): deterministic timeline file link detection and resolution (#53641) 2026-10-09 02:50:00 +00:00
location-layer.test.ts fix(core): close Locations in parallel on shutdown (#59326) 2026-10-26 11:59:58 -05:00
location.test.ts feat(core): archive projects whose directories are gone (#54354) 2026-10-10 21:11:05 -04:00
logging.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
mcp-attach.test.ts feat(core): add MCP transport over incoming client sockets (#57502) 2026-10-22 14:58:39 -04:00
mcp-import-boundary.test.ts perf(core): load MCP client lazily (#42468) 2026-08-13 22:48:09 -04:00
mcp-instructions.test.ts fix(core): expose code mode tools directly when execute is denied (#59315) 2026-10-26 10:48:31 -05:00
mcp-oauth.test.ts fix(core): coordinate credential refreshes across locations and processes (#54023) 2026-10-26 01:09:42 -05:00
mcp-socket-client.test.ts feat(core): add MCP transport over incoming client sockets (#57502) 2026-10-22 14:58:39 -04:00
mcp.test.ts feat(core): expose MCP server title from serverInfo (#58950) 2026-10-25 11:02:29 +00:00
mime.test.ts fix(core): tell HEIC, QuickTime and M4A apart from MP4 (#58887) 2026-10-26 00:04:36 -05:00
model-free.test.ts feat(core): add OPENCODE_DISABLE_FREE_MODELS to hide free models (#57478) 2026-10-20 22:18:42 -04:00
model-plugins.test.ts refactor(core): split provider and model registries (#48901) 2026-09-14 10:34:11 -04:00
model-resolver.test.ts refactor(ai): replace wildcard exports with an explicit public API (#59183) 2026-10-26 09:37:24 -05:00
model.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
models.test.ts feat(core): read the models.dev catalog from the experimental v2 API (#59296) 2026-10-26 12:17:31 -05:00
network-guard.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
npm-config.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
npm.test.ts chore: enable noUnusedLocals in ai and core (#52858) 2026-10-02 22:45:27 +00:00
oauth-page.test.ts feat(oauth): unify OAuth callback browser pages (#34025) 2026-06-26 00:36:40 -05:00
patch.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
permission.test.ts refactor(core): avoid redundant decode and re-branding in session inbox and projector (#57890) 2026-10-21 15:38:18 -05:00
persistent-pty-daemon.test.ts refactor(core): tighten worktree strategy and pty schemas and decode overlay once (#57950) 2026-10-21 20:57:46 -05:00
plugin-failure.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
plugin.test.ts feat(plugin): filter event subscriptions by type (#58864) 2026-10-26 10:47:48 -05:00
preload.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
preload.ts test(core): disable npm audits in the test preload (#47170) 2026-09-03 19:52:18 -05:00
project-icon.test.ts feat(core): show detected project icons (#59093) 2026-10-25 23:18:45 +00:00
project.test.ts perf(core): cache git discovery in Project.resolve by metadata fingerprint (#58616) 2026-10-24 14:34:07 -07:00
provider.test.ts refactor(ai): replace wildcard exports with an explicit public API (#59183) 2026-10-26 09:37:24 -05:00
reference-instructions.test.ts fix(core): send only changed entries in instruction updates (#57626) 2026-10-20 23:09:10 -05:00
reference.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
repository-cache.test.ts chore(ci): speed up and stabilize the test workflow (#55866) 2026-10-16 00:35:49 +02:00
repository.test.ts fix(core): reject relative path segments in repository hosts (#51577) 2026-09-28 10:14:35 +05:30
ripgrep.test.ts fix(core): exclude hidden glob matches before limiting results 2026-09-09 09:41:07 -04:00
rpc-handler-errors.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-activation.test.ts chore(ci): speed up and stabilize the test workflow (#55866) 2026-10-16 00:35:49 +02:00
session-archive.test.ts feat(app): add an experimental session inbox to the sidebar (#55647) 2026-10-19 14:37:57 +08:00
session-checkpoint-transport.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-compact.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-compaction-transport.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-compaction.test.ts perf(session): load a step's history once (#59091) 2026-10-25 22:27:39 -07:00
session-create.test.ts fix(core): treat trailing-slash directories as the same Location (#59327) 2026-10-26 11:59:37 -05:00
session-diff.test.ts fix(core): use the index when loading turn diffs (#59088) 2026-10-25 23:03:52 +00:00
session-environment.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-error.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-execution.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-generate.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-instructions.test.ts perf(session): load a step's history once (#59091) 2026-10-25 22:27:39 -07:00
session-list.test.ts refactor(core): page session lists in core (#56243) 2026-10-16 23:11:22 -05:00
session-log.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-model-request-hooks.test.ts fix(core): send unchanged hooked requests without copying the body (#59097) 2026-10-25 23:34:34 +00:00
session-model-request.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-model-transport-live.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-model-transport.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-move.test.ts fix(core): treat unreadable config file references as empty (#55959) 2026-10-16 01:12:37 -05:00
session-native-compaction.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-native.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-owned.test.ts feat(server): add experimental GET /api/experimental/media/:hash and opt-in experimental-media-uri capability (#59103) 2026-10-25 21:33:53 -07:00
session-projector.test.ts feat(core): opt-in blob writes for session media behind experimental.media_blob (#58741) 2026-10-25 15:48:45 -07:00
session-prompt.test.ts fix(core): tell HEIC, QuickTime and M4A apart from MP4 (#58887) 2026-10-26 00:04:36 -05:00
session-remove.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-revert.test.ts fix(tui): include provider latency in TPS 2026-09-17 10:40:12 -04:00
session-run-coordinator.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-runner-message.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-runner-recorded.test.ts feat(core): append model identity to system prompts via plugin (#49129) 2026-09-15 11:46:07 -05:00
session-runner-retry.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-runner-tool-events.test.ts chore: merge dev into beta 2026-10-26 08:34:06 +10:00
session-runner.test.ts refactor(ai): replace wildcard exports with an explicit public API (#59183) 2026-10-26 09:37:24 -05:00
session-shell.test.ts chore(ci): speed up and stabilize the test workflow (#55866) 2026-10-16 00:35:49 +02:00
session-skill.test.ts feat(core): enforce skill integration policies 2026-10-07 15:39:27 -05:00
session-sql.types.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-stats.test.ts fix(core): match versioned usage event type in stats (#48997) 2026-09-14 20:30:13 +05:30
session-step.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-store.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-system-prompt.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
session-title.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-tool-progress.test.ts fix(tui): include provider latency in TPS 2026-09-17 10:40:12 -04:00
session-usage.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
session-view.test.ts fix: surface session execution errors in desktop and TUI timelines (#53826) 2026-10-09 14:14:44 +10:00
session-wait.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
shared-schema.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
shell-cleanup.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
shell-parse-compatibility.test.ts fix(core): make the portable PowerShell scanner sound against real pwsh (#53404) 2026-10-05 14:07:15 -07:00
shell-parse-parity.test.ts feat(core): make the portable shell scanner authoritative 2026-08-26 16:35:16 -04:00
shell-parse-syntax.test.ts feat(core): make the portable shell scanner authoritative 2026-08-26 16:35:16 -04:00
shell-parse.test.ts feat(sdk): seed host plugins before recovery and harden workerd defaults (#54219) 2026-10-09 17:07:51 -07:00
shell-retention.test.ts feat(sdk): seed host plugins before recovery and harden workerd defaults (#54219) 2026-10-09 17:07:51 -07:00
shell.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
skill-discovery.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
skill.test.ts feat(core): stabilize top-level policies config (#55297) 2026-10-13 22:47:44 -05:00
snapshot.test.ts test: fix Windows flakes in cli standalone, Storybook and snapshot tests (#56181) 2026-10-16 18:24:02 +02:00
sqlite-bundle.test.ts fix(core): default #sqlite resolution to the node driver (#41834) 2026-08-11 17:50:09 -04:00
sqlite-workerd.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
state-group.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
state-replay.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
state.test.ts fix(core): publish catalog updates only when they change (#59084) 2026-10-25 22:58:29 +00:00
subagent-lifetime.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
tool-edit.test.ts fix(core): preserve mixed line endings in edit tool (#53166) 2026-10-12 16:22:58 +02:00
tool-execute.test.ts fix(core): ask the webfetch permission for Code Mode fetch calls 2026-10-26 14:30:37 -04:00
tool-html-markdown-budget.test.ts fix(core): terminate exhausted Markdown code budgets (#47408) 2026-09-09 09:15:11 -04:00
tool-opencode.test.ts feat(core): move worktree tools into core (#53981) 2026-10-08 17:23:43 -04:00
tool-output.test.ts refactor(core): name tool output files in ToolOutput (#52808) 2026-10-02 18:24:57 +00:00
tool-patch.test.ts fix(core): stop GPT patch edits from deleting a file moved onto itself (#59197) 2026-10-26 10:09:29 -07:00
tool-question.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
tool-read-filesystem.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
tool-read.test.ts fix(core): store opaque screenshots as JPEG before PNG (#56990) 2026-10-23 14:43:06 -07:00
tool-registry.test.ts fix(core): ask the webfetch permission for Code Mode fetch calls 2026-10-26 14:30:37 -04:00
tool-schema.test.ts refactor(ai): replace wildcard exports with an explicit public API (#59183) 2026-10-26 09:37:24 -05:00
tool-search.test.ts fix(core): exclude hidden glob matches before limiting results 2026-09-09 09:41:07 -04:00
tool-shell.test.ts feat(core): enable portable shell scanner on local and dev channels (#53479) 2026-10-05 22:13:16 -07:00
tool-skill.test.ts feat(core): enforce skill integration policies 2026-10-07 15:39:27 -05:00
tool-subagent.test.ts refactor(ai): make Promise the root entry and move Effect to @opencode/ai/effect (#58847) 2026-10-24 22:18:23 -05:00
tool-todo.test.ts fix(core): ask the webfetch permission for Code Mode fetch calls 2026-10-26 14:30:37 -04:00
tool-webfetch.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
tool-websearch.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
tool-write.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
usage-limits.test.ts feat(core): read OpenCode Console usage limits and classify budget refusals (#58694) 2026-10-24 11:13:12 -05:00
v1-migration.test.ts refactor(core): keep Go allowance out of messages and sessions (#58765) 2026-10-24 13:05:02 -05:00
variant.test.ts feat(core): read model reasoning from config (#55853) 2026-10-16 13:36:18 +02:00
vcs-hg.test.ts test(core): expect the vcs provider in info results (#49264) 2026-09-15 23:01:16 -04:00
vcs.test.ts fix(core): drop bare remote names from branch lists and search remote branches (#58597) 2026-10-25 22:39:51 -07:00
voice.test.ts feat(core): offer GPT-Live through an OpenCode Console connection without an OpenAI key (#58567) 2026-10-23 22:29:46 -05:00
websearch.test.ts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
wellknown.test.ts fix(core): broadcast wellknown updates globally and bound HTTP timeouts (#53821) 2026-10-09 15:17:26 -07:00
workspace.test.ts chore: upgrade Effect to rc.118 (#50231) 2026-10-09 01:36:06 -07:00
worktree.test.ts refactor(core): tighten worktree strategy and pty schemas and decode overlay once (#57950) 2026-10-21 20:57:46 -05:00