feat(core): add request-scoped action surfaces - #2811
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Visual recap — skippedThe visual recap job did not run for this pull request. This is informational only and does not block the PR. Recap skipped for |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93639b55cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return filterPromptActionsToSurface( | ||
| actions, | ||
| getRequestRunContext()?.allowedActionNames, | ||
| ); |
There was a problem hiding this comment.
Filter agent-team child registries through the request surface
When a resolver allows agent-teams but denies a template action, this helper scopes the run-code bridges only; createTeamTools still receives the unfiltered buildSubAgentActions registry at agent-chat-plugin.ts:2922-2926, and spawning snapshots those actions in browser-team-tools.ts:515-550. The parent can therefore delegate a prompt to a sub-agent that executes an action omitted from the hard allowlist. Apply the request surface to the child registry before spawning or persisting the task.
Useful? React with 👍 / 👎.
| (options?.systemPrompt ?? | ||
| (lazyContext | ||
| ? PROD_FRAMEWORK_PROMPT_COMPACT | ||
| : PROD_FRAMEWORK_PROMPT)) + resolveRequestActionsPrompt("tool"); |
There was a problem hiding this comment.
Filter static framework guidance with the action allowlist
When the surface omits framework actions such as tool-search, agent-teams, or manage-jobs, this still prepends the unchanged production framework prompt, whose directives name and recommend those tools (framework-core.ts:147,161 and framework-core-compact.ts:121,131). This contradicts the option's promise that omitted names are not sent to the model and encourages calls to tools that are absent from the provider schema. Generate or suppress framework guidance according to the resolved surface as well as filtering the generated action list.
Useful? React with 👍 / 👎.
93639b5 to
84f871a
Compare
84f871a to
07c58af
Compare
|
great idea, thanks @tillkrueger02! one last piece of feedback a review agent of mine found - if you agree would be great to get the fix in, then good to merge: [P1] Preserve the request action surface for queued I found one remaining authorization gap in the durable sandbox path. The foreground As a result, the worker can fall back to the full action registry. A resolver that allows Please propagate the resolved action surface through the sandbox queue/worker context and add a regression test covering enqueue → worker execution → denied bridge/action call. If background |
…action-surface # Conflicts: # packages/core/src/server/agent-chat-plugin.surface.spec.ts
There was a problem hiding this comment.
Builder reviewed your changes — looks good ✅
Review Details
Code Review Summary
Reviewed the latest PR #2811 head for the request-scoped action-surface feature. The implementation propagates hard action allowlists through provider schemas, direct execution, tool search, prompts, plan mode, sandbox/run-code bridges, durable continuations, and agent-team workers. It also preserves organization binding across durable execution, distinguishes explicit org-less requests from legacy payloads, rejects inherited action names, and fails closed for malformed persisted authorization data.
The previously identified trusted-shell bypass, multi-organization sub-agent binding, durable run-code restoration, malformed persisted surface, and inherited-property issues were verified as addressed. Three parallel code-review passes found no new actionable bugs or security regressions. This is a high-risk authorization-sensitive change, but the current approach and regression coverage are sound.
🧪 Browser testing: Skipped — PR only modifies backend/config/docs, no UI impact
Summary
resolveActionSurfacecallback to interactive agent chat.Why
Apps sometimes need to expose different actions depending on the current user, organization, thread, or agent configuration.
Previously, the interactive agent chat used one static action registry for every request. Apps could authorize actions during execution, but they could not narrow the set of actions visible to the model for an individual request.
A request-scoped action surface allows apps to expose only the actions that are relevant and permitted for the current run, without replacing or duplicating the Agent Native chat runtime.
Changes
resolveActionSurfaceplugin option.tool-searchTests
A full workspace
pnpm run prepwas also attempted. The relevant Core, typecheck, and guard phases passed. Unchanged Calendar, Content, and Slides template tests produced unrelated failures or timeouts; this PR does not modify those packages.Risk / Rollback
resolveActionSurfaceis not configured.Checklist