Skip to content

feat(eval): call-scoped host-tool policy for kernel-tool invoke (nested host calls run parent-permissioned) #1731

Description

@code-yeongyu

Summary

kernelTools.invoke({name, kernel_generation, definition_revision, args, call_id}, signal?) (shipped in #1647 / #1728) runs the parent's registered JavaScript function inside the parent worker. Any tool.<host>() call the closure makes during that invocation executes on the parent's host bridge with the parent's full tool surface and permissions. A consumer that grants such a tool to a child session with a narrower tool policy therefore has only two options today: refuse the grant, or accept that nested host calls run with the parent's permissions.

Expected (ideal state)

invoke accepts an optional execution scope for nested host calls made by the closure during that call, e.g. { tools: { allow?: string[], deny?: string[] } } or an opaque scope token the consumer obtained from the child's effective tool policy. While the invocation is active, a nested tool.<name>() outside the scope fails closed with a typed error (kernel_tool_host_denied or similar) on the invoking call's channel, without affecting the parent's own top-level cells. The scope is per call (call-scoped bridge context already exists for the reentrant pump), never persisted, and absent scope keeps today's behavior.

Actual

No scope parameter exists. The consumer (omo's in-process child grant, oh-my-openagent#8226) refuses grants for children with explicit allow/deny narrower than the parent and for curated read-only agents, and documents that nested host calls otherwise run parent-permissioned.

Acceptance criteria

  • Typed scope option on invoke, forwarded through the worker protocol to the call-scoped bridge context.
  • Nested host call outside the scope: typed error on the invoking call, the closure sees a rejected promise, the parent's queue is unaffected.
  • Scope is dropped when the call settles (including interrupt/reset); no persistence in transcripts or records.
  • Real-transport tests: allowed nested call succeeds, denied nested call fails closed, interrupt during a scoped nested wait settles once.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions