Repository navigation
fix(server,mobile): deduplicate keyed thread launches - #21611
Open
juliusmarminge wants to merge 3584 commits into
Open
juliusmarminge wants to merge 3584 commits into
juliusmarminge wants to merge 3584 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An agent retrying
t3_thread_launchafter credential rotation can create another thread. A stableclientRequestIdnow names one launch for the calling thread and provider instance. The same key and arguments recover the accepted thread; omitted keys stay fresh.The existing thread-claim receipt binds the original request with a SHA-256 fingerprint in the claim transaction. This closes the crash window before initial-message admission and prevents a no-message launch acquiring later retry work. Preparation reads the accepted run's saved workspace intent. A fresh launch reusing an empty thread replaces a stale checkout binding with the requested workspace and atomically rejects a concurrent checkout change; an unprepared draft keeps its branch choice if preparation fails. A conflicting or historically unverifiable launch intent returns actionable MCP
invalid_requestguidance. Pending attachment copies are released on rejection. Mobile derives a queued worktree branch from its persisted command UUID so a lost-response retry retains the same launch arguments. Migration 65 adds one nullable receipt column; the full request is not added to client projections.Rebuilt from @maria-rcks's #17589. This layer contains launch retry handling; the preceding layer preserves restart steering.
Verification:
validate-intent; a projection read confirms the original title and zero messages/runs. No external provider started. Migration 65 applied successfully on startup.Keys bind the complete original launch arguments, including inherited defaults. Changed arguments need a fresh key after inspecting existing work. Historical claims without a fingerprint require an already accepted initial-message receipt; missing workspace intent is refused. No-message workspace preparation has no new durable rescheduling workflow. A fresh reused launch that fails worktree preparation leaves its accepted workspace unbound instead of restoring the old checkout. A claim rejected for a concurrent checkout change needs a fresh key after inspecting the current thread. Workspace preflight can still fail if a base ref or existing checkout disappears after acceptance; inspect the accepted thread before choosing another key. Key scope also becomes stable across credential replacement for other keyed MCP operations. An edited queued mobile creation can visibly fail if the original launch was accepted before its thread appears in the live shell; inspect that thread before retrying with new arguments.
No live provider, actual HTTP MCP credential rotation, physical OS restart, macOS, Windows, iOS, Android, or Electron desktop verification. Those platform and account checks remain for a human. Fresh reuse workspace verification uses real service/orchestrator/SQLite code with faked Git and setup services; no real checkout or shell setup was driven. The mobile change is payload construction only; it introduces no native capability, asset, persisted format, or visual control.
Implementation: GPT-6.1-Sol; tests: GPT-6-Astra; independent full-diff reviews: Claude Opus 5.5 and GPT-6-Sol, through T3 Code's Codex and Claude harnesses.
Fixes #16184