Skip to content

fix(server): isolate V2 Cursor metadata and own request cleanup - #9940

Open
saphid wants to merge 392 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:fix/v2-cursor-metadata-lifecycle-20260905
Open

fix(server): isolate V2 Cursor metadata and own request cleanup#9940
saphid wants to merge 392 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:fix/v2-cursor-metadata-lifecycle-20260905

Conversation

@saphid

@saphid saphid commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Cursor metadata generation used write-capable agent mode in the project directory. Use an isolated temporary workspace, plan mode, sandboxing, and no ambient settings for title, branch, commit and PR text generation.

Keep the 180-second caller deadline through stalled workspace or SDK acquisition. Application-provided CursorRequestLifetime owns SDK completion and cleanup; provider-instance closure requests cancellation without destroying the workspace before SDK settlement. Application shutdown cancels remaining fibers and retains unsettled workspaces. No imperative Effect runtime bridge remains.

Current head 2b68f136d is based on V2 7dd9873ed with test-only prerequisite #10865 (merge first). Validation: 15 text-generation/driver/registry tests and server typecheck, targeted lint and formatting pass. New CI pending. No authenticated Cursor call was made. Direct Claude Opus 5 high review was retried for this change and exited 1 due to expired OAuth before inference; no independent review occurred.

Targets V2 #2829; #9914 is the separate ACP implementation for main. Updated with GPT-6 in Codex/T3.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 5, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR changes the default execution model for every Cursor metadata-generation request and adds substantial asynchronous request, cancellation, sandbox, and temporary-workspace lifecycle behavior. It also introduces a static-analysis diagnostic suppression in tests, so the combined scope and policy impact warrant human review.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from 9242b91 to 3d81172 Compare September 8, 2026 03:31
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@saphid

saphid commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Independent automated first-pass review (Amp/Astra): 1 finding. Addressed in f8a04ca: provider-scope close while a metadata request was in flight permanently leaked the temporary workspace (the interrupt exit branch only requested cancellation, and the scope-close test asserted the leak). The completion fiber now starts immediately so its exit finalizers always run, and workspace removal is scheduled once the SDK request settles. Verified with the 8 focused Cursor text-generation tests, server typecheck, and targeted lint.

@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies.

@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Sep 8, 2026
juliusmarminge and others added 20 commits September 7, 2026 23:12
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Restore the failed-before-start timer guard, align two server fixtures with the reconciled behavior, and remove dead files, exports, and dependencies surfaced by Knip.

Drop the temporary branch push trigger now that the PR is mergeable, so each update runs the pull-request workflow once.
Keep main's batch machine-update banner and update action while preserving the v2 runtime-based environment lock used by draft load balancing.
Adopt TypeScript 7 and Effect rc.112 across orchestration v2, including the TaggedError API migration and updated Effect-aware tests. Restore main's composer-aware scroll-to-end clearance while retaining selected-model settings sync, preview recording transfer, image galleries, desktop context menus, and layout hit targets. Regenerate the lockfile on the upgraded dependency baseline.
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from efd9994 to 6102d00 Compare September 8, 2026 06:23
juliusmarminge and others added 9 commits September 8, 2026 14:26
Advertise bounded socket snapshots and authoritative dispatch validation, omit raw command output and inline file bodies at the wire boundary, and preserve compact status metadata across web and mobile. Add transport-budget coverage for snapshots, resume, commands, legacy import, and projection maintenance.
…ettlement

Closing the provider instance scope while a metadata request was in flight only requested SDK cancellation and permanently leaked the temporary workspace; the scope-close test asserted the leak. Start the completion fiber immediately so its exit finalizers always run, and schedule workspace removal once the SDK request settles (after cancellation and disposal), preserving the workspace while the SDK may still use it.
@saphid
saphid force-pushed the fix/v2-cursor-metadata-lifecycle-20260905 branch from eee0dfc to d4da069 Compare September 9, 2026 00:31
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XXL 1,000+ changed lines (additions + deletions). labels Sep 9, 2026
Comment thread apps/server/src/textGeneration/CursorTextGeneration.ts Outdated
@macroscopeapp

This comment has been minimized.

Comment thread apps/server/src/textGeneration/CursorTextGeneration.ts
Comment thread apps/server/src/textGeneration/CursorTextGeneration.ts Outdated
@macroscopeapp

This comment has been minimized.

Comment thread apps/server/src/provider/Drivers/CursorDriver.ts Outdated
Comment thread apps/server/src/textGeneration/CursorTextGeneration.ts Outdated
Comment thread apps/server/src/provider/CursorRequestLifetime.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Effect Service Conventions found three blocking convention violations. See the inline review comments for the expected fixes.

Posted via Macroscope — Effect Service Conventions

@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from 8187b17 to ada72ce Compare September 9, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants