Skip to content

Add createExternalResource agent tool - #427

Draft
ndisidore wants to merge 5 commits into
mainfrom
nathan/create-external-resource
Draft

Add createExternalResource agent tool#427
ndisidore wants to merge 5 commits into
mainfrom
nathan/create-external-resource

Conversation

@ndisidore

@ndisidore ndisidore commented Sep 2, 2026

Copy link
Copy Markdown
Member

Adds the createExternalResource tool as discussed with respect to Google Drive: rather than granting whole-Drive access so the agent can make one document, the agent creates a new resource of a creatable type through an already-connected account.

This adds the other half of requestConnection: the agent mints a brand-new resource of a type the vendor marks creatable, through an account the user already connected. The binding is live immediately (simliar to what createGadget does), the turn continues, and the gatekeeper simulates the resource until the user approves the creation, which queues first and applies first, so dependent edits are safe to stack behind it.

Auto approval is not supported yet.

Screenshot from 2026-09-07 16-50-55 Screenshot from 2026-09-07 16-53-21

First consumer is Google Doc creation, stacked as #428

@github-actions github-actions Bot added workshop/frontend Changes to the Workshop frontend kernel Changes to the Workshop kernel workshop/shared Changes to shared Workshop APIs labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Preview: pr427-nathan-create-f79af453

https://pr427-nathan-create-f79af453-router.cloudflare-os-previews.workers.dev

Dashboard · deleted when this PR closes

@ask-bonk

This comment was marked as outdated.

@ask-bonk

This comment was marked as outdated.

Base automatically changed from kenton/worktrees to main September 3, 2026 19:22
@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from a37f164 to ccb9d9a Compare September 4, 2026 15:04
@ask-bonk

This comment was marked as outdated.

@ask-bonk

This comment was marked as off-topic.

@ask-bonk

This comment was marked as outdated.

@ask-bonk

This comment was marked as outdated.

@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from a5eceb8 to 8604cbd Compare September 4, 2026 23:39
@ask-bonk

This comment was marked as outdated.

@ask-bonk

This comment was marked as outdated.

@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from 8604cbd to 19d6322 Compare September 7, 2026 19:38
@ask-bonk

This comment was marked as outdated.

const summary = getToolCallSummary(toolCalls[0], outputOf);
// Label by the last call: for same-target retries the final outcome wins (a failed create
// retried successfully is "Created", not "Tried").
const summary = getToolCallSummary(toolCalls[toolCalls.length - 1], outputOf);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so createExternalResource is the one tool where a "failure" is just a normal string result the model reads and retries on
every other tool gets away with a dumb count label because the error machinery covers their failures separately. we can't just set tc.error on rejections either - the tool call itself succeeded, it returned guidance the model is supposed to act on, and flagging that as an error would paint the designed fix-and-retry flow red like something broke.
so if we did "created 2 external resources" when one was actually rejected, the group header would straight up lie about the thing the user is being asked to approve - hence this one case counts successes

open to other options here

@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from 19d6322 to e9ee3a1 Compare September 7, 2026 20:29
@ask-bonk

ask-bonk Bot commented Sep 7, 2026

Copy link
Copy Markdown

Findings

  1. High: Creation-only steps return false because no "changes" message was written, despite committing the tool call. The deferred restart is therefore skipped, leaving the new gatekeeper permanently quarantined whenever a build collaborator is connected. Track barrier success separately from change materialization. packages/workshop-backend/src/overseer.ts:3843

github run

@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from e9ee3a1 to 34bfa3e Compare September 7, 2026 21:39
@ask-bonk

ask-bonk Bot commented Sep 7, 2026

Copy link
Copy Markdown

Findings

  1. High: Rejected creations remain in build-collaborator verification scope. ACL-based gatekeepers will reject verification for the nonexistent resource, preventing collaborators from reopening the workspace. Persist a terminal state and exclude it from observer requirements. packages/workshop-backend/src/overseer.ts:11611

  2. Medium: Chat deletion can remove a newly committed creation before deleting chatMeta. A crash in that window leaves replay restoring a binding to a deleted gatekeeper. Use a durable deletion tombstone or atomic lifecycle transition. packages/workshop-backend/src/overseer.ts:2745

  3. Low: Automatic cleanup marks queued actions as user-rejected, so history displays “Denied” despite no user decision, contradicting ActionState semantics. Remove or distinguish system-cancelled actions. packages/workshop-backend/src/overseer.ts:5573

github run

@ndisidore
ndisidore force-pushed the nathan/create-external-resource branch from 34bfa3e to 0fd3f8c Compare September 8, 2026 00:05
@ask-bonk

ask-bonk Bot commented Sep 8, 2026

Copy link
Copy Markdown

Findings

  1. High: The first action queued during initialization is blindly marked as the creation action. Since the record is already accessible, a concurrent session can queue another action first, corrupting approval, rejection, refresh, and recovery behavior. Block sessions until submitCreationAction() establishes the real creation action. packages/workshop-backend/src/overseer.ts:6054

  2. High: Rejected creations are excluded from collaborator verification while their gatekeeper remains accessible. A new build collaborator can call getGatekeeperById().openSession() without addObserver() verification; Gatekeeper.rejectAction() does not guarantee future sessions are disabled. Explicitly reject sessions for rejected creations. packages/workshop-backend/src/overseer.ts:9557

  3. Low: Missing resolvedBy also applies to legacy user-denied actions, so these are now incorrectly labeled “Cancelled.” Add an explicit system-cancellation discriminator instead. packages/workshop-frontend/src/Activity.tsx:102

github run

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

Labels

kernel Changes to the Workshop kernel workshop/frontend Changes to the Workshop frontend workshop/shared Changes to shared Workshop APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant