Skip to content

feat(threads): archive and restore owned work on linked machines - #786

Merged
lastobelus merged 12 commits into
lastcode/mainfrom
lastcode/archive-linked-receipts
Nov 20, 2026
Merged

lastobelus merged 12 commits into
lastcode/mainfrom
lastcode/archive-linked-receipts

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Part of #751

What changed

Archiving an orchestrator now reaches the threads it owns on directly linked machines. The confirmation shows the exact threads to archive and the ones that stay open. Including a thread you wrote in or stopping active linked work requires your consent.

Each machine authorizes its own archive, records what it archived, and returns a receipt. The local archive and restore finish before any request goes to another machine. A peer that fails to stop releases its temporary hold, and the source keeps the failure visible for review. Restore reopens only the threads recorded in the receipts, without restarting work. Once a machine receives the restore, it refuses late archive requests for the same operation.

When a machine can't finish

Machine has… What you see
No connection Pending · Offline. The local archive still finishes.
Refused access Blocked · Access denied. The machine stays listed.
An older build Blocked · Update this machine to review its threads.
Choices that changed after review Needs review when the machine can supply a new preview.

Open Archived threads → Linked archive status to retry. A retry reuses the saved choices for the same local archive. If the choices changed or a machine could not show them before, review them before retrying. Retries are explicit so an unavailable machine cannot archive work the user had no opportunity to review.

A restore that cannot reach a machine stays pending. Open Linked archive status on the restored thread to retry it. The dialog lists the current operation and earlier pending restores by archive date, so each can be retried separately.

Scope

Coverage follows recorded ownership on each directly linked machine. Ownership chains that pass through a second linked machine are out of scope. Temporary-project cleanup remains local.

Web and desktop share the thread menu, sidebar, bulk and saved-workspace confirmations. Mobile uses its archive sheet and thread menu. Agents get the preview and commands through t3_thread_archive_family and t3_thread_organize.

Verification

  • Changed-file checks passed with 542 tests, 38 affected-package typechecks and React compiler coverage. The focused MCP and peer archive suites passed 33 tests. Quick CI passed on 65a3dee7feb88a7d4300a64adc052b7fa1d00b14.

  • In the managed Browser, two real paired development environments with separate SQLite databases archived the selected work, kept a thread with a human message open, and restored the committed cohort. Archive and restore both succeeded on explicit retry after an offline peer returned. The projection and durable journal were checked on both machines.

  • The recovery picker passed a browser test. Refused and older peers are covered by focused transport and client checks. Mobile coverage consists of client tests and typecheck.

  • Archive timing covers dispatch through local completion. It used 12 timed batches of 50 synthetic idle-root archives per row after warmup with the real service and in-memory SQLite. Wall times varied with local activity. Recording a pending peer added journal work and made zero peer calls before local completion.

    Workload Median per 50 Range
    lastcode/main local 1,167 ms 521–1,604 ms
    This branch, local 657 ms 449–1,162 ms
    This branch, a named pending peer 825 ms 659–1,037 ms
  • The updated tool preview supplies copyable default linked choices and per-operation retry arguments. Copyable choices cannot stop active work. A saved retry that can stop work requires an explicit stop disposition before the source replays it. The childless active and unread guidance is restored.

  • Agent context compared against c3abd81fd3c2. Claude system append 23,198 → 23,198 bytes (0). Codex additional context 24,196 → 24,196 (0). MCP tool list 85,503 → 85,797 (+294). The checkpoint owns the snapshot.

Archive and thread-read evals

GPT-6.1 Sol at xhigh with the Terra shell simulator. Three samples per case.

Step MCP bytes over main Busy owner Archive retry Pending restore All archive samples
Previously published text +1,733 3/3 — — 21/21
Copyable replies and full input schema +1,421 2/3 1/3 3/3 24/27
Compact advertised input, full decoder +345 1/3 1/3 3/3 23/27
Thread-list cue and machine outcomes in replies +309 2/3 3/3 3/3 26/27
Keep the published thread-read cue +294 3/3 3/3 3/3 27/27
Safe defaults with active linked cohorts +294 3/3 3/3 3/3 27/27
Final saved-stop retry guard +294 3/3 3/3 3/3 30/30 across the completed case runs

All final cases passed 3/3. The first run completed 28 of 30 samples without a graded failure. Two typed-in samples ended with Responses stream ended without response.completed. A fresh three-sample typed-in run on the committed head passed 3/3. The saved-stop guard passed 3/3 in the full run.

Thread-read routing passed 37/45, including 9/9 for attached, ID-only and machine-directed mentions. The five wake/recovery cases with misses passed 7/15. A control using main’s archived-tool cue on those same five cases passed 8/15. Both versions missed samples in all five cases. The broader run includes response phrasing, exact paging and recovery expectations. The published archive cue stayed because agents otherwise sometimes decided whether an owner was available without inspecting the archive family.

Archive confirmation before

Linked archive preview before peer archive was available

Archive confirmation with pending work

Archive confirmation naming an offline peer and showing where to retry

Upstream-owned files touched

File Added Removed
apps/mobile/src/App.tsx 2 0
apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx 22 1
apps/mobile/src/features/threads/thread-list-v2-items.tsx 21 2
apps/mobile/src/i18n/translations/de.json 13 3
apps/mobile/src/i18n/translations/en.json 13 3
apps/mobile/src/i18n/translations/es.json 13 3
apps/mobile/src/i18n/translations/fr.json 13 3
apps/mobile/src/i18n/translations/ja.json 13 3
apps/mobile/src/i18n/translations/ko.json 13 3
apps/mobile/src/i18n/translations/pt-BR.json 13 3
apps/mobile/src/i18n/translations/ru.json 13 3
apps/mobile/src/i18n/translations/sv.json 13 3
apps/mobile/src/i18n/translations/zh.json 13 3
apps/server/src/mcp/toolkits/orchestrator/tools.ts 1 1
apps/server/src/mcp/toolkits/thread/handlers.ts 27 9
apps/server/src/mcp/toolkits/thread/tools.ts 12 7
apps/server/src/server.ts 17 1
apps/server/src/ws.ts 16 6
apps/web/src/components/settings/ArchivedThreadsPanel.tsx 30 8
apps/web/src/hooks/useThreadActionMenu.test.ts 5 0
apps/web/src/hooks/useThreadActionMenu.ts 17 1
apps/web/src/i18n/translations/de.json 14 4
apps/web/src/i18n/translations/en.json 14 4
apps/web/src/i18n/translations/es.json 14 4
apps/web/src/i18n/translations/fr.json 14 4
apps/web/src/i18n/translations/ja.json 14 4
apps/web/src/i18n/translations/ko.json 14 4
apps/web/src/i18n/translations/pt-BR.json 14 4
apps/web/src/i18n/translations/ru.json 14 4
apps/web/src/i18n/translations/sv.json 14 4
apps/web/src/i18n/translations/zh.json 14 4
docs/user/thread-sidebar.md 9 3
packages/client-runtime/src/operations/commands.test.ts 17 0
packages/client-runtime/src/operations/commands.ts 13 0
packages/contracts/src/orchestrationV2.ts 9 1

Local review: 4 rounds with Codex Terra (xhigh), approved after the scope review and simplification. The owner’s tool-context revision took three additional rounds with Codex Terra (xhigh) and was approved.

@lastobelus lastobelus changed the title feat(threads): archive and restore reviewed work on linked machines feat(threads): archive and restore owned work on linked machines Nov 20, 2026
@lastobelus
lastobelus marked this pull request as ready for review November 20, 2026 12:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T13:28:13.162235Z 65a3dee Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 04097b6691

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Part of #751.

Store source and destination archive state by qualified owner and generation. Reserve a missing generation with an insert and use revision-checked updates to keep stale writers from replacing committed state.

Implemented with GPT-6.2 Sol in Codex via T3 Code.

Carry-Group: incubator
Part of #751 (D4, part 2).

Recheck recorded ownership and reviewed human-message evidence under the destination archive locks. Persist the exact shutdown cohort and restore only rows matching its committed archive transitions.

Implemented by GPT-6.2 Sol in Codex.

Carry-Group: incubator
Persist each environment's selected archive cohorts and their receipts. Confirm exact work in the clients and tools, then allow explicit retries after the local archive or restore has finished.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Direct responsibility and availability checks during wrap-up to the family preview.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Keep unfinished restore generations reachable after a later archive. Bind renewed peer consent to ordered revisions and retain the destination's admitted work and receipts. Move the client control and MCP policy behind fork-owned seams.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Expose the current archived generation and pending earlier restores to the clients and archive tools. Let users pick a dated operation and pass its exact generation back on retry.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Release only the exact failed attempt authorized by the destination before applying a newly reviewed subset or empty selection. Retain dismissal receipts so retries recover after interruption.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Use Effect DateTime for the local date in the linked operation picker so shared-runtime typechecking passes.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Reuse exact destination-authorized dismissal during fenced restore. Cover both a failed cohort and a hold left by an interrupted replacement, and verify real local shutdown completion starts peer work while preserving the local journal proof.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Report linked failures through the source journal and clear the exact in-progress hold on the destination when shutdown fails. Remove the later dismissal protocol and preserve committed cohorts and restore fencing.

Implemented with GPT-6 Sol in LastCode.

Carry-Group: incubator
Include migration 24 in the five existing upgrade assertions that check the full LastCode migration sequence. These assertions now cover the archive journal alongside the earlier migrations.

Implemented with GPT-6 in LastCode.

Carry-Group: incubator
@lastobelus
lastobelus force-pushed the lastcode/archive-linked-receipts branch from 04097b6 to 3ef779c Compare November 20, 2026 12:45
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 3ef779ce39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Move linked archive and restore choices into tool replies while continuing to validate the full selection. Restore the childless archive guidance and require fresh stop consent for a saved MCP retry that can stop linked work.

Implemented with GPT-6.2 Sol in LastCode.

Carry-Group: incubator
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 65a3dee7fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@lastobelus lastobelus added the agent-context-increase Intentional agent context growth approved by a maintainer label Nov 20, 2026
@lastobelus
lastobelus merged commit 3d386d7 into lastcode/main Nov 20, 2026
36 of 37 checks passed
@lastobelus
lastobelus deleted the lastcode/archive-linked-receipts branch November 20, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Intentional agent context growth approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant