Skip to content

end: add approval policy schema - #807

Open
heerambavi1998 wants to merge 3 commits into
ha/inboxfrom
ha/approval
Open

heerambavi1998 wants to merge 3 commits into
ha/inboxfrom
ha/approval

Conversation

@heerambavi1998

@heerambavi1998 heerambavi1998 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

add approval policy event schema.

Changes

How was this tested?

NA

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Low Risk
Schema and OpenAPI-only additions with no harness runtime behavior in this PR; approval-related wire format is extended but not executed here.

Overview
Introduces a send-only client inbound event user.tool_approval_policy for sticky tool-approval rules, alongside existing per-call user.tool_approval / user.tool_response on session send (POST …/sessions/{id}/events).

The payload is a list of (server, tool_name) entries whose action is allow_session, with an optional ISO expire_at for time-bounded session allows. It follows the same pattern as other HITL resume messages: validated on send, not added to the durable AgentOutputEvent stream.

Session send OpenAPI expands the inbound item union to accept the new type (OpenAPI name SendTurnEventItem), with docs updated to distinguish tip HITL vs sticky policies. Public trueforge-core exports include the new schema and types. Changesets note a follow-up SDK regen from the updated OpenAPI spec.

Reviewed by Cursor Bugbot for commit b981228. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b981228

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@truefoundry/trueforge-sdk Patch
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge-core/src/core/events/schema.ts Outdated
Comment thread .changeset/pre/user-tool-approval-policy-event.md Outdated
Comment thread packages/trueforge-core/src/core/events/schema.ts Outdated
Comment thread packages/trueforge-core/src/core/events/schema.ts Outdated
Comment thread packages/trueforge-core/src/core/events/schema.ts Outdated
Comment thread .github/fern/openapi/openapi.json Outdated
Comment on lines +5797 to +5808
"UserToolApprovalPolicyStreamEvent": {
"allOf": [
{
"$ref": "#/components/schemas/UserToolApprovalPolicyEvent"
},
{
"properties": {
"created_at": {
"description": "ISO 8601 event timestamp.",
"type": "string"
},
"id": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets avoid allOf here

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

.object({
server: z.string().min(1, 'server is required').describe('MCP server name the tool belongs to.'),
tool_name: z.string().min(1, 'tool_name is required').describe('Tool name this policy applies to.'),
action: z.discriminatedUnion('type', [ToolApprovalPolicyAllowSessionSchema]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-variant action union

Low Severity

The action field is a one-member discriminatedUnion on type. That emits a single-variant oneOf instead of a flat object alias, which new wire schemas avoid until a second action variant exists.

Fix in Cursor Fix in Web

Triggered by project rule: @truefoundry/trueforge review rules

Reviewed by Cursor Bugbot for commit f2e3aa5. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b981228. Configure here.

"@truefoundry/trueforge-sdk": patch
---

Regenerate SDK from updated OpenAPI spec.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDK changeset without SDK regen

Low Severity

This changeset bumps @truefoundry/trueforge-sdk for an OpenAPI regen that is not in the PR. The new send-event schema is not wired to a route, and neither openapi.json nor the SDK were regenerated, so merge would publish an empty SDK patch.

Fix in Cursor Fix in Web

Triggered by project rule: TrueForge review rules

Reviewed by Cursor Bugbot for commit b981228. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants