Skip to content

feat(runtime): complete production Write/Edit recovery #4319

Description

@Phoenix500526

Problem

Maka's Runtime resume documents distinguish the recovery work that has landed from the remaining Phase 3 work. Phase 3A established the durable T1/T2 boundary, RecoveryResolver, and atomic recovery-bundle persistence in #1521. Production Write/Edit recovery—trusted file evidence, a filesystem observer/reconciler, and the Host-owned recovery lifecycle—remains documented but is not represented by a focused GitHub issue.

Documentation alone is difficult to use as a progress tracker: contributors cannot query or assign the remaining work, connect child PRs to one canonical checklist, or quickly tell which parts have shipped. This also makes it easier for the design and implementation status to drift apart.

This issue tracks the narrow Phase 3 PR C/D work already described by the architecture. It does not introduce a new recovery design or promise generic automatic recovery for every tool.

Design sources:

Related roadmap: #544

Desired outcome

Use this issue as the canonical, queryable progress tracker for production Write/Edit reconciliation. Keep the checklist and architecture status updated as child PRs land.

Current documented baseline

  • Durable T1/T2 tool boundaries
  • Canonical tool-ledger scanner and RecoveryResolver
  • Atomic persistence and rebuild of recovery bundles
  • Persist a versioned Write/Edit recovery contract and trusted file evidence before dispatch
  • Add the Host-owned recovery contract registry
  • Implement the filesystem worker and finalize-only Write/Edit observer/reconciler
  • Scan eligible indeterminate operations and submit recovery bundles through the canonical SQLite authority
  • Wire the Host lifecycle across startup, cancellation, shutdown, initialization failure, and owner conflicts
  • Add production-shaped crash, concurrency, and lifecycle coverage
  • Update the architecture status and this checklist as each slice lands

Required first-version policy

  • matches_expected_state: finalize without rewriting the file, synthesize the missing successful outcome, and commit a completed recovery bundle.
  • matches_prior_state: park with redo_disabled_pending_cas.
  • diverged or unreadable: park without mutating external state.
  • Missing, incompatible, or unverifiable contracts and evidence must fail closed.

Out of scope or explicitly deferred

  • Automatic redo before a conditional replace/CAS protocol exists
  • ShellRun reattachment, Bash replay, or generic child-process recovery
  • Generic reconciliation for remote APIs or MCP tools
  • Phase 4 Git workspace checkpoints, isolated restore, or durable rebaseline
  • Exactly-once guarantees for arbitrary external side effects

Alternatives or workarounds

Continue tracking the work only in architecture documents. That preserves the design, but it does not provide issue ownership, linked implementation progress, or a single status surface for contributors and maintainers.

Activity

  1. bug-superman commented on Sep 3, 2026

    @bug-superman

    This was generated by AI during triage.

    I’d like to take the first dependency-ordered implementation slice for #4319.

    Bounded scope for my PR:

    • define a versioned Write/Edit recovery contract and trusted pre-dispatch file evidence;
    • register and persist that evidence through the existing Host/runtime recovery authority;
    • enforce the fail-closed policy for missing, incompatible, or unverifiable contracts;
    • add focused tests for contract validation, evidence binding, crash-safe persistence, and the matches_expected_state / matches_prior_state / diverged outcomes.

    I will not add generic automatic redo, Bash/ShellRun recovery, or remote API reconciliation. The filesystem observer/reconciler and broader Host lifecycle will remain separate follow-up slices under this tracker. PR #4333 is documentation-only and does not implement this work.

    I’ll first verify the current Runtime/Host recovery seams against main, then open a focused PR with the smallest compatible change. Please let me know if maintainers prefer a different first slice.

    中文摘要

    我希望认领 #4319 的第一个依赖有序切片:定义并持久化版本化的 Write/Edit recovery contract 与派发前可信文件证据,接入现有 Host/Runtime 恢复权威,补齐缺失或不可验证时的 fail-closed 测试。不会在这个 PR 中加入通用自动重做、Bash/ShellRun 恢复或远程 API reconcile;文件 observer/reconciler 和 Host 生命周期会作为后续独立切片。

  2. added theissue type on Sep 8, 2026
  3. me2seeks commented on Sep 11, 2026

    @me2seeks
    Contributor

    Hi @bug-superman — are you still planning to work on the first #4319 slice you outlined on September 3 (the versioned Write/Edit recovery contract and trusted pre-dispatch evidence)?

    I am preparing a separate stacked contribution to make the existing safe-boundary resume path practically available by default for explicit TUI/Desktop actions, including a Desktop user-stop resume affordance. I want to avoid overlapping your recovery-contract work.

    If your slice is still active, I will stay out of it and keep my stack strictly at the product activation/presentation boundary. If you are no longer working on it, please let us know so we can coordinate ownership of a later recovery slice rather than duplicating work.

    No urgency implied; this is only an ownership check before implementation.

    简体中文

    想确认一下:你在 9 月 3 日声明的 #4319 第一切片(版本化 Write/Edit recovery contract 与派发前可信 evidence)是否仍在推进?我正在准备一个独立的 Stack,只负责让现有 safe-boundary resume 默认可用于用户主动触发的 TUI/Desktop 操作,并补齐 Desktop 用户中止后的 Resume 入口。为了避免重复,如果你的切片仍在进行,我会完全避开 recovery-contract 范围;如果已经不再推进,也请告知,我们再协调后续 ownership。

    AI assistance: Codex helped trace the current ownership and draft this coordination comment.

  4. added
    tracking
    on Sep 17, 2026
  5. added
    stale
    on Oct 12, 2026
  6. github-actions commented on Oct 12, 2026

    @github-actions

    This issue has had no human activity for 30 days and has been marked stale. It will be closed in 30 days unless someone comments.

    If the issue is still current, please confirm it against the latest main and add any information that would help move it forward. Assigned issues and issues labelled pinned are exempt from this policy.

  7. jackeyfaker77 commented on Oct 13, 2026

    @jackeyfaker77
    Contributor

    Automated update posted with OpenAI Codex on behalf of @jackeyfaker77.

    I have prepared a PR for the first checklist item: versioned Write/Edit recovery contracts and trusted file-state evidence persisted before dispatch. Both tools capture bounded pre-state and expected post-state in the filesystem executor, bind the evidence to the dispatch identity, and persist it through the existing atomic T1 boundary. Edit preparation and execution share the existing matching transform; guarded execution rejects changed preconditions. Conversation copies rebind the evidence to the copied identities, and historical dispatches without evidence remain readable.

    This is the evidence-producing foundation only. Write/Edit retain never_auto_retry; a Host-owned recovery registry, reconciliation decisions, and recovery lifecycle/scanning remain separate checklist items. I will reference this issue without closing it.

    Local build, typecheck, lint, format, both Knip checks, license headers, and 180 focused tests pass. The PR will document existing Windows filesystem/SQLite cleanup failures reproduced on the upstream baseline, and native Linux/macOS sandbox validation still needed in CI.

  8. removed
    stale
    on Oct 14, 2026
  9. added
    stale
    on Nov 13, 2026
  10. github-actions commented on Nov 13, 2026

    @github-actions

    This issue has had no human activity for 30 days and has been marked stale. It will be closed in 30 days unless someone comments.

    If the issue is still current, please confirm it against the latest main and add any information that would help move it forward. Assigned issues and issues labelled pinned are exempt from this policy.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    staletracking

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions