Skip to content

feat(runtime): establish the managed mutation acceptance kernel - #40

Draft
zhiiw wants to merge 13 commits into
mainfrom
codex/managed-write-edit-stack-v1
Draft

feat(runtime): establish the managed mutation acceptance kernel#40
zhiiw wants to merge 13 commits into
mainfrom
codex/managed-write-edit-stack-v1

Conversation

@zhiiw

@zhiiw zhiiw commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Establish the managed mutation kernel that owns the durable boundary from T1 reservation through terminal settlement and atomic SQLite successor acceptance.

This PR intentionally stops before Gitoxide candidate reopening and accepted-ref repair. Those recovery and projection responsibilities now live in a second stacked delivery so this PR has one primary invariant:

Once a managed Write/Edit T1 is durable, only the owner-scoped managed settlement path may commit its terminal outcome; provider outcome, accepted successor, canonical workspace head, and reservation release are either committed together or not committed at all.

Ownership

  • Runtime owns the original Write/Edit arguments, the bounded pure transform, the immutable provider-result snapshot, and the exact durable response envelope.
  • Execution Stores / SQLite owns the cross-process reservation, terminal transaction, accepted workspace history, and disposable projections.
  • The managed mutation authority owns candidate/no-effect verification through issuer-scoped capabilities; generic RuntimeEvent/T2 writers cannot settle a managed operation.

Atomic boundary

For a successful mutation, SQLite commits the tool outcome, workspace successor fact, canonical head CAS, and reservation release in one transaction. For no-change or a proven no-effect business failure, SQLite commits the terminal outcome and reservation release without advancing the head.

Failure and retry states

  • Pre-T1 admission failure: no reservation and no tool execution.
  • Managed no-change/no-effect: one durable terminal, no head movement.
  • Valid successor: one atomic accepted successor.
  • Missing or conflicting proof: unsettled/fail closed; no generic fallback.
  • Exact historical retry: returns the immutable accepted result even after a later legal head advance.

The no-effect bearer is now bound to its issuing owner, concrete execution store, and durable storage-root identity. Runtime also constructs the terminal outcome once and uses that same immutable event for live publication and durable settlement.

Follow-up boundary

The stacked Gitoxide recovery PR owns durable candidate receipt reopening, accepted-ref projection, active-reservation recovery state, and production-shaped helper crash evidence. It does not widen this PR's SQLite or Runtime authority.

Verification

  • Rebuilt from current upstream/main.
  • git range-diff preserved all six extracted commits exactly.
  • Core, Storage, Runtime, and Runtime Host builds pass in the full stack.
  • Focused mutation/settlement/persistence tests pass.
  • Cross-store no-effect capability forgery is rejected.
  • git diff --check passes.
中文说明

摘要

本 PR 只建立 managed mutation kernel,负责从 T1 reservation 到 terminal settlement 与 SQLite 原子 successor acceptance 的 durable 边界。

Gitoxide candidate 重开与 accepted-ref 修复已经移到第二个 stacked PR。本 PR 只证明一个主要不变量:

managed Write/Edit 的 T1 一旦持久化,只有 owner-scoped managed settlement 才能提交终态;provider outcome、accepted successor、canonical workspace head 与 reservation release 必须同时提交或全部不提交。

Owner

  • Runtime:拥有原始 Write/Edit 参数、有界纯 transform、不可变 provider result snapshot 与精确 durable response envelope。
  • Execution Stores / SQLite:拥有跨进程 reservation、terminal transaction、accepted workspace history 与可重建 projection。
  • Managed mutation authority:通过 issuer-scoped capability 验证 candidate/no-effect;generic RuntimeEvent/T2 writer 无权结算 managed operation。

原子性与失败状态

成功 mutation 在一个 SQLite transaction 中提交 tool outcome、workspace successor fact、canonical head CAS 与 reservation release。no-change 或已证明无副作用的业务失败只提交 terminal outcome 并释放 reservation,不推进 head。

缺少证明或证明冲突时 fail closed,禁止 generic fallback。no-effect capability 已绑定签发 owner、具体 execution store 与 durable storage-root identity;Runtime 只构造一次 terminal outcome,live publication 与 durable settlement 使用同一 immutable event。

后续边界

第二个 stacked Gitoxide recovery PR 负责 durable candidate receipt 重开、accepted-ref projection、active reservation recovery state 与真实 helper crash evidence,不会扩大本 PR 的 SQLite/Runtime 权限。

验证

本分支已从最新 upstream/main 重建;六个 extraction commits 经 range-diff 全部精确保留;Core、Storage、Runtime、Runtime Host 构建通过;mutation/settlement/persistence 定向测试通过;跨 store 伪造 no-effect capability 会被拒绝;git diff --check 通过。

… re-login (apache#3358)

* fix(desktop): show the Codex device sign-in code on connection-detail re-login

The connection detail sheet's re-login notice drives the same
browser-assisted OAuth flow as the provider catalog panel, but never
rendered the flow's stateHint. For Codex that hint is the 9-digit device
user code the authorization page requires — the verification URL does not
embed it — so a re-login started from the notice could never be completed.

- OAuthLoginService gains showsDeviceCode: true for Codex, false for xAI,
  whose page needs no manual code (mirrors the catalog panel's !isXai
  guard). The mapping stays in use-connection-detail so the legacy AppShell
  closure gains no file and no dependency.
- OAuthReloginNotice appends the sign-in code to the banner description
  while authorization is pending, reusing the catalog's deviceCode copy.

Fixes apache#3357

Generated-by: Claude Code (Fable 5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): normalize locked npm registry sources (apache#3381)

Replace stale Microsoft 1ES proxy resolutions with the canonical npm registry tarballs while preserving the exact package versions. Refresh their integrity metadata to npm-published SHA-512 digests so clean installs no longer depend on an unrelated proxy.

Generated-by: Codex

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Wang <m4n5terrr@gmail.com>
This was referenced Aug 30, 2026
liuxiaocs7 and others added 11 commits August 30, 2026 20:36
Add production-reachable Storybook coverage for empty activity, capped many-session summaries, long generated reports, and failed generation archives.\n\nRefs apache#3944 and apache#3893.
Seventh surface under apache#3944 (one surface per PR): the Agent Graph panel had no
Storybook story. Add its failure and edge states, mounted through a scoped
`window.maka.graphs` bridge inside the real composer host seam
(.maka-detail-with-artifacts → .mainColumn), each pinning one
AgentGraphClientSnapshot.

- EmptyGraph — graph mode enabled, no operators yet: the panel's empty state.
- FailedGraph — a failed operator beside completed/running ones.
- BlockedOnUpstream — a blocked operator with the amber "waiting for input" line.
- ManyOperators — a wide fan-out (28 operators) with no fabricated omitted count
  (the read-model only elides operators past 256) — review feedback.
- LoadError — the IPC snapshot read rejects: the panel's error Banner + Retry.

The panel renders operators as a flat list (no edges/hierarchy), so tree depth
and cycles have no distinct rendering and are left out. Plays assert
reachability of each state; exact row counts / omitted lines are read-model
contracts left to the read-model's own tests (review feedback).

Refs apache#3944, apache#3893

Generated-by: Claude Code
Sixth surface under apache#3944 (one surface per PR): extend the chat transcript
(ChatView → materializeTurns → TurnView, via Product/Shell Official AppShell)
with the failure and edge states that never show up in normal use. All feed a
real message ledger through ComposedShell, like InterruptedToolAfterTurnAbort.

- FailedTurnWithToolError — a tool call errors mid-turn and the turn settles
  `failed`: the errored tool row plus the failed Banner + erroredTool description.
- ProviderRateLimited — a settled `failed` turn with errorClass 'rate_limit'.
- ProviderRetrying — a live turn whose providerRetry swaps the working phrase
  for the ModelProviderRetryIndicator banner.
- SafeResumeAfterRestart — the last turn failed with errorClass 'app_restarted',
  offering the warning-severity Banner with the 继续这一轮 safe-resume button.
- ManyTurns — 120 turns, past the transcript virtualizer's window (review
  feedback: 20 did not guarantee the virtualization path).

Streaming, aborted/interrupted, empty, and long-message states were already
covered, so this adds only the genuinely missing ones. All are safe
presentational states driven by the message ledger and live overlay.

Refs apache#3944, apache#3893

Generated-by: Claude Code
* refactor(runtime): remove unvalidated Auto tool guidance

Remove the prompt fragment, composition wiring, export, and feature-specific tests added by apache#3705. Maka has no demonstrated retry-loop reproduction or A/B evidence for this guidance, and the implemented best-fit wording does not match the issue’s CLI-first premise.

Generated-by: OpenAI Codex

* test(core): remove speculative sanitizer coverage

Remove the direct sanitizer matrix added by apache#3692. It was not tied to a reported regression, planned behavior change, or failing contract, while existing session-name and foreign-session tests continue to cover the real trust-adjacent behavior.

Generated-by: OpenAI Codex
Canonicalize Seatbelt roots through the deepest existing ancestor so writable roots and explicit denies share one path namespace. Fail closed on permission errors, symlink loops, and other non-missing canonicalization failures.
* fix(desktop): connect shared sessions through Peer Mesh

Join managed Runtime Hosts through explicit Client and Host Mesh targets, recover stale authority routes over management channels, and expose managed Host Mesh actions directly.

Persist signed endpoint and Mesh names, keep stable identifiers copyable, and make Mesh rosters collapsible without exposing internal revisions.

Generated-by: Codex

* fix(peer): connect Mesh members to managed Hosts

Activate Relay v2 reservations when transit policy is added to an existing peer connection, and preserve native path failures as stable errors. Keep managed endpoint metadata and signed routes atomic while tightening the Desktop management boundary.

Generated-by: OpenAI Codex

* fix(cli): accept managed Mesh operator context

Allow the generic managed-service operator launcher to pass its validated client data root through Peer Mesh commands, so Desktop can reconcile managed Hosts instead of failing during argument parsing.

Generated-by: OpenAI Codex

* fix(peer): recover Mesh routes through reachable members

Generated-by: OpenAI Codex

* fix(desktop): make peer collaboration recoverable

* fix(peer): preserve active Mesh transport paths

* fix(desktop): recover interrupted managed Host setup

* fix(desktop): activate managed Host Peer Mesh

* fix(cli): replace incompatible development Hosts

* refactor(desktop): isolate Runtime Host management UI

* test(runtime-host): finalize owner pairings explicitly

* fix(desktop): make Peer Mesh refresh local and bounded

* style(cli): format Runtime Host setup changes

* docs(astryx): refresh surface inventory
@zhiiw
zhiiw force-pushed the codex/managed-write-edit-stack-v1 branch from cc194db to a6bf8f3 Compare August 30, 2026 14:06
@zhiiw zhiiw changed the title feat(runtime): establish durable Gitoxide Write/Edit acceptance feat(runtime): establish the managed mutation acceptance kernel Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants