Repository navigation
refactor(archive): isolate family archive policy and add agent consultation - #742
Conversation
…tation Move family planning, shutdown, archive reads and client controls into fork-owned modules while preserving receipt locks, durable attempts and historical restore cohorts. Offer optional consultation with the actual execution owner through ordinary queued messages. Part of #720 Carry-Group: incubator Carry-Fix: #720 Carry-Observation: Archive policy, shared contracts, multi-surface controls and their regression tests form one inseparable feature extraction. Implemented with GPT-6.1 Sol (xhigh) in Codex through LastCode.
Keep stale pending tasks and failed archive attempts consultable, while holding questions for background work or unavailable provider runtimes. Preserve mobile archive failure feedback. Part of #720 Carry-Group: incubator Carry-Fix: #720 Carry-Observation: Consultation eligibility is part of the family archive policy extraction. Implemented with GPT-6.1 Sol (xhigh) in Codex through LastCode.
Exclude app-owned delegated-task display rows when checking whether an execution owner can answer an archive question. Keep native subagents and background tools busy, and cover actual delegated turn-item rows. Part of #720 Carry-Group: incubator Carry-Fix: #720 Carry-Observation: Recipient execution checks must distinguish owned task rows from independent background execution. Implemented with GPT-6.1 Sol (xhigh) in Codex through LastCode.
258a0c3 to
3690fb3
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Keep archive family, thread reads, listings and delegated-task state consistent so the eval reaches the intended consultation choices. Prompts and graders are unchanged. Carry-Group: incubator Carry-Fix: #720
Observe actual lock acquisition in regression fixtures, select the ordinary mobile conversation without an import cycle, and direct archive questions through authoritative consultation targets and the ordinary queue. Preserve the eval safety guards while fixing inconsistent fallback data and completion capitalization. Carry-Group: incubator Carry-Fix: #720
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Consolidate duplicated archive instructions without dropping consultation safeguards. Require exact inspection IDs in model eval fixtures, match the production response and use synthetic UUIDs. Carry-Group: incubator Carry-Fix: #720
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Direct archive readiness checks and blocked-work questions to the authoritative family inspection at the read entry point. Move the hint from Send without increasing agent context. Carry-Group: incubator Carry-Fix: #720
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
## Why Deleting owned descendants with their parent is fork-only behavior. It grew from upstream's side-chat cleanup into owned descendants and worktree cleanup, and all of it sat inline in the delete case of the `Orchestrator.ts` dispatcher. That block keeps showing up in upstream replay diffs. This is part of [the Orchestrator conflict-reduction work](#720) and follows [the archive planner extraction](#742). ## What changed Worktree planning, descendant deletion and effect collection now live in one fork-owned module, `apps/server/src/orchestration-v2/LastCodeThreadFamilyDeletion.ts`. The delete case calls it. - **Dispatcher** owns locks, the receipt, the participant guard and the commit. - **Deletion planner** produces each thread's events and effects. - **Protected-descendant test** (`ThreadFamilyLifecycle.integration.test.ts`) now asserts that every thread in the family stays active and that the root command queues no effects. ## Measured effect Against the shared upstream baseline: | | Before | After | | --- | --- | --- | | Downstream lines added in the delete case | 139 | 2 | | Changed lines in the `Orchestrator.ts` diff | 7,361 | 7,219 | | Total lines in `Orchestrator.ts` | 23,128 | 22,984 | In the 14-day sample, two upstream changes touched the delete case or its three-line context. The table measures the diff against that baseline. Nightly conflict frequency remains to be measured. ## Verification - 148 focused tests passed. - Quick CI passed. - The changed-file check passed, including 158 tests. Local review: 1 round with GPT-6.1 Terra (xhigh), approved at `dca9ceef530b5866e90f89192c92827e03dae79f`. Implemented with GPT-6.2 Sol (xhigh), Codex through LastCode. Carry-Source-Ref: refs/lastcode/carry-sources/pr-911/dca9ceef530b5866e90f89192c92827e03dae79f Carry-Source-Base: f8085a1 Carry-Source-Head: dca9cee
Ready to merge. Local checks, GitHub CI and exact-head review pass. The paired model eval meets all four case thresholds.
Problem
Family archive logic is spread through upstream-owned files (
Orchestrator.ts,ThreadManagementService.ts,useThreadActions.tsand the mobile equivalents). Every upstream checkpoint carries that code, so each carry is expensive.When archive is blocked by work that looks stuck, the user also has no way to ask the agent doing it whether it is finished.
Change
Fork-owned seam. The archive planner, shutdown runner, reads/contracts and client archive controls now live in fork-owned modules (
LastCodeArchivePlanner,LastCodeArchiveRunner,ThreadArchiveReader,lastcodeThreadArchiveActionson web and mobile). Upstream files keep thin call sites.Optional Ask the agent. In the archive dialog, Ask the agent sends a question to the agent that actually owns the blocked work.
Preserved behavior
Upstream's cascade (https://redirect.github.com/pingdotgg/t3code/pull/33921) is intentionally not imported.
Also adds four
family-archiveeval cases and a short Ask the agent note indocs/user/thread-sidebar.md.Scope
Part of #720. This is a refactor plus one small optional feature, driven by that issue.
Carry measurement. With the same upstream ref, changed lines in the touched upstream-owned paths fall from 21,559 to 18,061 (−3,498); contextual diff hunks fall from 527 to 523. That is not the whole archive denominator, and it is below the original 6–8k estimate.
Verification
Server
Client
Gates
check:changed: format, lint, dependency analysis, GraphQL generation, 37 package typechecks, 1,106 tests and 11 React compiler checks passed.Real-model comparison
Browser acceptance passed for busy and eligible consultation, delivery of the ordinary question, stop/archive, and Settings restore through an archived child. Failed archive visibility was checked in a separate synthetic projection fixture; server tests cover the actual shutdown failure path.
Local review: 3 rounds with gpt-6.1-terra (xhigh) and claude-opus-5-5 (high), approved.
UI evidence
Before sending, a busy owner gets Review and Stop alternatives; an idle owner can receive Ask:
Question delivery through the ordinary conversation:
archive-ask-delivery.mp4
Stop and archive:
archive-stop.mp4
Failed archive remains visible with retry and dismissal (synthetic visual fixture):
Implemented with GPT-6.1 Sol (xhigh), Codex through LastCode.