Skip to content

Stage MCP tool outputs in Redis and write GCS behind markAsSucceeded. - #32770

Merged
Fraggle merged 3 commits into
mainfrom
sflory/mcp-output-redis-stage
Sep 21, 2026
Merged

Fraggle merged 3 commits into
mainfrom
sflory/mcp-output-redis-stage

Conversation

@Fraggle

@Fraggle Fraggle commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

MCP tool outputs now stage in Redis before markAsSucceeded, allowing polling and the agent loop to read content without waiting for GCS. createOutputItems and SandboxFunctionMCPActionResource defer durable GCS writes until after success, then expose awaitDeferredOutputPersist to finish persistence before the activity exits while retaining DB-content fallbacks and structured-output support.

Tests

Updated Vitest coverage for deferred persistence, structured content, successful durable writes, GCS write failures, DB row creation, and GCS cleanup. No manual testing recorded.

Risk

Medium risk in the Redis staging and write-behind consistency window. Redis staging remains best-effort, DB content remains available for agent outputs, sandbox actions fall back to synchronous GCS persistence when staging fails, and durable-write errors are logged and surfaced to the caller. Roll back by reverting the front changes.

Deploy Plan

Deploy front. No SQL migrations or infrastructure changes are required. Monitor Redis staging failures, deferred GCS persistence errors, and MCP output availability after rollout.

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
playground Ignored Ignored Preview Sep 21, 2026 12:56pm UTC
storybook Ignored Ignored Preview Sep 21, 2026 12:56pm UTC

Request Review

@Fraggle
Fraggle force-pushed the sflory/dsbx-action-poll-cadence branch from b025dfc to 6917231 Compare September 18, 2026 21:25
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from 74bffe0 to 5b025fe Compare September 18, 2026 21:25
@Fraggle
Fraggle force-pushed the sflory/dsbx-action-poll-cadence branch from 6917231 to 7e67049 Compare September 18, 2026 21:35
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from 5b025fe to 295f208 Compare September 18, 2026 21:35
@Fraggle
Fraggle force-pushed the sflory/dsbx-action-poll-cadence branch from 7e67049 to f5f66ad Compare September 21, 2026 08:40
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from 662a77a to b4230f2 Compare September 21, 2026 08:40
@Fraggle
Fraggle force-pushed the sflory/dsbx-action-poll-cadence branch from f5f66ad to 86f6cba Compare September 21, 2026 12:54
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from b4230f2 to 1d48b64 Compare September 21, 2026 12:54
@Fraggle
Fraggle force-pushed the sflory/dsbx-action-poll-cadence branch from 86f6cba to 433b9c7 Compare September 21, 2026 12:54
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from 1d48b64 to c8d71ca Compare September 21, 2026 12:54
Base automatically changed from sflory/dsbx-action-poll-cadence to main September 21, 2026 12:55
Fraggle and others added 3 commits September 21, 2026 12:55
Poll and agent loop can read staged content immediately; durable persist finishes after success so tools.persistOutput drops off the critical path.
Same helpers and key scheme as agent MCP output warm/read instead of a hand-rolled Redis SET/GET.

Co-authored-by: Cursor <cursoragent@cursor.com>
Follows resource-identifier-naming: string IDs are <resource>Id, not *SId.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Fraggle
Fraggle force-pushed the sflory/mcp-output-redis-stage branch from c8d71ca to e4ac137 Compare September 21, 2026 12:56
private deferredOutputPersist: Promise<Result<void, Error>> | undefined;

/**
* Awaits a durable GCS persist started by {@link createOutputItems} with

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.

Is 'durable' here referring to 'durable' function calls, as opposed to fast calls?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nope, durable as "in GCS".

@davidebbo

Copy link
Copy Markdown
Contributor

LGTM

@Fraggle
Fraggle merged commit ff24974 into main Sep 21, 2026
68 checks passed
@Fraggle
Fraggle deleted the sflory/mcp-output-redis-stage branch September 21, 2026 13:57
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