Skip to content

[DO NOT MERGE] feat(server): fork Codex threads at checkpoints - #7

Draft
sameerr03 wants to merge 2 commits into
archive/01-destructive-cleanupfrom
fork/01-codex-workspace-workflow
Draft

[DO NOT MERGE] feat(server): fork Codex threads at checkpoints#7
sameerr03 wants to merge 2 commits into
archive/01-destructive-cleanupfrom
fork/01-codex-workspace-workflow

Conversation

@sameerr03

@sameerr03 sameerr03 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Warning

DO NOT MERGE — personal-fork V1 experiment.

This is the backend half of the Codex edit/fork feature stack. It is based on #5 because both features coordinate destructive worktree lifecycle operations through the same server semaphore; it does not depend on the commands, selected-reply, or mobile stacks.

The problem: a fork must keep the selected conversation boundary and repository filesystem at the same point. Message order alone is not enough because Codex supports queued follow-ups and provider starts can fail before a turn exists.

How this works:

  • adds a typed, operate-scoped thread-fork RPC for Codex
  • resolves the exact provider-turn boundary, refusing missing, running, or non-ready checkpoints
  • creates an isolated branch/worktree and restores the selected checkpoint there
  • uses Codex thread/fork for native conversation context and binds it to the child thread
  • records durable parent lineage without copying T3 event history
  • compensates the thread, terminal, locked/partial worktree, and branch if creation, setup, or native forking fails

Validation:

  • server and contracts typechecks
  • 82 projection, provider-service, and Codex-adapter tests
  • 49 authorization and orchestration contract tests
  • focused WebSocket fork/boundary/cleanup tests
  • real Git test proving forced cleanup removes a locked worktree
  • real T3 web-client run proving an assistant fork retained native context and left the parent unchanged
  • targeted lint and formatting checks
  • adversarial review: no remaining correctness or data-loss findings

The real-client pass caught a Git timeout that occurred after a worktree was partially created. Follow-up commit 38fd5b0e7 precomputes the exact worktree path and compensates even when create returns an error; the reproduction artifact was removed.

Stack:

Built with GPT-5.6-Sol through the Codex harness in T3 Code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Aug 20, 2026
@sameerr03
sameerr03 force-pushed the fork/01-codex-workspace-workflow branch from 56e87de to 38fd5b0 Compare August 20, 2026 04:26
@sameerr03
sameerr03 changed the base branch from mobile/01-done-notifications to archive/01-destructive-cleanup August 20, 2026 04:26
@github-actions github-actions Bot added size:XXL and removed size:XL labels Aug 20, 2026
@github-actions

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 38fd5b0.

This comment will update automatically after the next completed run.

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

Labels

size:XXL 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.

1 participant