Skip to content

Advance #93: snapshot recovery, trusted context, and JSONL ownership - #123

Merged
leonardoaraujosantos merged 142 commits into
mainfrom
feat/managed-recovery-owner
Nov 17, 2026
Merged

leonardoaraujosantos merged 142 commits into
mainfrom
feat/managed-recovery-owner

Conversation

@vanedaltro

@vanedaltro vanedaltro commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Advances #93.

This branch advances issue #93 across snapshot recovery, trusted rules/context inspection, structured results, and concurrent JSONL execution. It is a shared implementation and review checkpoint: substantial functionality exists, but the remaining acceptance and implementation work below prevents merge readiness. Issue #93 stays open after this PR.

Base: main. Branch: feat/managed-recovery-owner. Handoff revision: 20e0aae0fcf1bc8e4402aea75c80005f5b8f3a18.

Implemented behavior

Snapshot recovery and rewind

  • Adds Location-bound, content-addressed BLAKE3 file-copy snapshots, conflict-aware restoration, native ownership records, preserved displaced preimages, and recovery journals.
  • Adds reviewed keep/rollback planning and confirmation, durable request lookup, and paired Store settlement of the original worker and recovery request. Committed requests can be reconciled after a lost response without reinstalling source files.
  • Retains worker, checkout, activity and shutdown ownership through filesystem work and disposal. Partial construction and cancellation record uncertainty before releasing ownership.
  • Adds reference-aware payload/metadata reclamation work, including zero-byte inventories, retained retry receipts and Location continuity handling. Unknown or unresolved evidence remains protected.
  • Adds typed CLI/API/SDK recovery operations and TUI recovery/preparation flows, preserving rewind previews, draft restoration and existing Git compatibility. Managed Git default admission remains gated pending acceptance.

Trusted rules and context inspection

  • Discovers bounded, trusted project/global rules with validated relative globs and precedence. Unscoped rules join baseline instructions; matching scoped rules are delivered after successful authorized file operations.
  • Carries actual native read/edit/patch effect receipts, including hook-rewritten input, partial patch effects and intercepted shell patches. Durable delivery binds the operation, dispatched attempt, Location, native root and Context Epoch.
  • Adds bounded instruction assembly and authenticated context inspection through HTTP and TUI /context. Inspection reports source origin/status, estimates, pending Epoch/source state and the last prepared request estimate; stored content is hidden by default.
  • Synchronizes configuration validation, doctor diagnostics, command help/localization, OpenAPI and generated SDK artifacts.

Structured results and JSONL ownership

  • Extends root structured-output handling and regression coverage for schema admission, correction retries, compaction, interruption/budgets, terminal settlement and committed acknowledgement loss.
  • Retains JSONL inputs until their owned process Jobs, notifier-accepted handbacks and unread durable revisions settle. Bounded ownership queries and immutable step/Job provenance replace broad Session history scans and collection of unrelated Jobs.
  • Adds authenticated retained input-scoped interrupt submission/lookup. The driver reconciles the same exact cohort and waits for its settlement revision; unknown or mixed ownership never falls back to Session-wide interruption. SIGINT and fatal protocol input retain their documented exit behavior.
  • Adds immutable admission-bound input-client presence with dedicated leases. A second controller, browser attachment or global stream cannot keep another input's permission/question request attended. Restart restores bindings without restoring live lease authority.
  • Separates observational JSONL event streams from Session attendance. Reply-type validation preserves the original waiter, and reply cascades stay within the recorded client scope.

Work other teams can take

These are suggested work areas, not assigned owners. Coordinate ownership in this PR before editing shared runtime/Store interfaces. Branch from this head and target contribution PRs at feat/managed-recovery-owner so the combined implementation remains reviewable.

Work area Remaining outcome Entry points / acceptance tasks
Recovery and storage Finish native partial-journal construction, exact origin/intent crash cuts, complete conflict/reconciliation and reference/CAS/metadata reclamation; preserve unknown fences and Git exclusions crates/cyber-snapshot/src/copy/, crates/cyber-server/src/runtime/snapshot_*, crates/cyber-core/src/worktrees/activity/snapshot/, crates/cyber-store/src/store.rs; tasks 2.4, 3.2–3.4, M2–M8
Rules and context Finish exact configuration-generation/revocation provenance, withdrawal and restart behavior, full next-request projection, leakage and native acceptance crates/cyber-core/src/rules.rs, crates/cyber-server/src/runtime/instructions*, context_inspection.rs, crates/cyber-app/tests/instructions.rs, TUI context inspection; tasks 4.1–4.4
JSONL and runtime Finish descendant/hook presence and ownership, complete mixed-cohort handling, broader event/result correlation, bounded stdout backpressure, hook events and full protocol restart/lost-ack acceptance crates/cyber-cli/src/, runtime/input_clients.rs, input_interrupt.rs, input_jobs.rs, requests/input_owners.rs, crates/cyber-cli/tests/exec_stream_input.rs; tasks 6.2–6.4
Acceptance and review Obtain current-source Linux x64/ARM and macOS Intel/ARM evidence, explicit Windows limits/results, complete client/crash tests, consolidate substantive review and reconcile delivery artifacts .github/workflows/non-git-snapshot-proof.yml, runtime/CLI/TUI fixtures, tasks 5.4 and 7.1–7.4

Use the existing approved OpenSpec design and task IDs. Include meaningful regressions and update evidence with the exact revision, commands, results, skips and retained failure artifacts. Focused increment reviews do not establish whole-branch acceptance. Issue #92 remains a separate workstream; preserve its accepted dependencies without assuming unfinished guarantees or choosing its pending policies.

Verification and limits

Recorded local verification for the latest presence increment:

  • Server library: 472 passed; one ignored subprocess fixture is exercised by its Location-lock parent. Integration suites: six input-client, ten browser attachment, 22 request, nine interruption, 16 Goal and 88 HTTP cases passed.
  • Client library: 19 passed. CLI: 105 binary unit and 18 real JSONL cases passed, including six shared-Session controller cases across the unit suite.
  • SDK typecheck and 139 tests passed; ten configured end-to-end tests skipped.
  • CLI/client/server all-target Clippy passed with warnings denied and complexity limit 15. OpenAPI/SDK consistency, formatting and diff checks passed.
  • Strict OpenSpec validated 100 items; spec lint reported zero errors and 25 warnings. Workflow YAML and shell syntax checks passed. Native C deprecation and linker unwind-size warnings were observed.

These are recorded local results, not a fresh full-workspace or cross-platform run. At handoff, GitHub reports 32 successful and 13 failed checks on 20e0aae0. The failures include Linux builds, web, bootstrap, packaged-entry, regression and native snapshot jobs. Their current-head logs have not yet been diagnosed here; do not assume they have the same cause as earlier failures. See the current CI run and the PR Checks tab for the other workflows.

Earlier-revision Linux logs showed Ubuntu mirror DNS failures and masked sandbox prerequisite installation. This branch makes prerequisite failure explicit, retains its log and prevents dependent native proof steps from running without successful Linux sandbox setup. A failed prerequisite still fails the job; skipped proof is not accepted as passing.

Authoritative handoff documents

Keep this PR draft until the remaining required behavior, current-source acceptance and consolidated review are complete. Archive the change and reconcile the issue checklist only after accepted delivery.

Continuation, 2026-11-12: rules and context (tasks 4.3–4.4)

  • Up to date with main at 1855ae45+, including the Rust 1.99.1 CI pin from Pin Rust 1.99.1 in CI and fix Rust 1.100 lints #129. One conflict, in config/load.rs, where both sides added a trust source; both are kept. The 13 failed checks on 20e0aae0 were all Ubuntu mirror DNS failures (Temporary failure resolving 'azure.archive.ubuntu.com'), not code failures.
  • Changed-on-disk sources: instruction files record their size and modification time from the handle they were read through. Context inspection compares these with current metadata, without opening any file, and reports changed_on_disk per source and a changed_sources count. It covers up to 512 files per inspection. A source without complete stamps reports unknown. TUI /context shows both.
  • Next-request estimate: next_request is the stored projection plus the last prepared request's tool schemas. It lists its assumptions: tool schemas from the last request, changed model, pending Epoch rebuild, sources changed on disk, and excluded turn-only instructions. It is absent before the first prepared request. It is an estimate, not an exact projection.
  • 4.4 test: a scoped rule is delivered again, once, after compaction starts a new Epoch.
  • Local results (Rust 1.99.1, macOS): server library 473, HTTP 88, context/compaction 25, app instruction tests 19, TUI context tests 12; cyber-core 896. Clippy on the changed crates is clean with warnings denied. OpenAPI and SDK are regenerated and consistent. OpenSpec strict passes 103 items, and lint reports 0 errors and 25 warnings. The SDK typecheck was not run locally because SDK dependencies are not installed; CI covers it.
  • Tasks 4.3 and 4.4 stay open pending platform acceptance and the remaining exact-projection and configuration/revocation provenance work.

Continuation, 2026-11-13: CI fixes and JSONL acceptance (task 6.4)

  • Snapshot worker shutdown race: the acknowledgement and preparation workers released the shutdown lifecycle guard before clearing snapshot_active, so shutdown() could return while a worker still looked busy (intermittent Linux failure of disposed_acknowledgement_request_retains_actual_worker_resources_through_shutdown). They now release it last, as SnapshotWorker already did.
  • Windows --output-last-message: concurrent writers to one path could fail with "Access is denied" while another rename onto it was in progress; a busy destination is now retried briefly on Windows.
  • Windows recovery test bound: reviewed_recovery_code_stages_survive_kill_restage_and_clear_without_adopting_owner_files already took 8–9.5 of its 10 minutes on main's Windows runner; it now has 20 there.
  • JSONL tests (real binary): a 33rd pending input is a protocol error (exit 2) with every admitted input still settled; a line over 1 MiB is refused before any model call; a stalled stdout reader delays but neither loses nor reorders results; and a lost admission acknowledgement, tested against cyber serve through a proxy that commits each prompt but drops its responses, ends with the input admitted and the model called once. Removing the driver's retry makes that test fail.
  • Open: if the driver's retry is lost too, it reports the input refused although the server committed it.

Doubly lost JSONL admission (task 6.4)

  • When a prompt submission and its one same-ID retry both lose the server's reply, the driver now reads GET /sessions/{id}/inbox for that message ID before reporting the input. A held row that is not refused is reported admitted and tracked to its result. No row is reported refused. If the inbox can't be read, the run ends with exit 2 and an error naming the message ID; it never reports a prompt the server may run as refused.
  • exec-mode spec delta: new scenario "An admission acknowledgement is lost". docs/local-core-guide.md documents the behaviour.
  • Tests against a real cyber serve through a proxy that drops all eight prompt responses: an_admission_whose_retry_is_also_lost_is_confirmed_from_the_inbox and an_unconfirmable_admission_fails_the_run. The first fails, with the input reported refused, when the lookup is forced to answer "not committed".
  • The macOS Intel failure of the lost-ack test was a product bug. Generated server passwords are base64url, so about one in 64 starts with -, and --password -Y… was rejected as an unknown flag. cyber exec --password, cyber review --password and cyber service password <value> now accept hyphen values, and a parse regression test covers all three. The exec and serve stderr that the test failure now shows is what exposed it. The test server also binds --port 0 and reads its URL; that's harmless, but it was not the cause.
  • Server crash under an attached driver: the run ends with exit 2 (the server closed the event stream), the waiting input gets not answered before the run ended, and the restarted server still holds the input (a_server_crash_ends_the_run_explicitly_and_the_restarted_server_keeps_the_input). The driver does not reconnect across a restart; this is documented in the guide.

Continuation 2026-11-14: rule fencing, inspection and JSONL ownership (tasks 4.1–4.4, 6.2–6.4, 7.1)

No task was checked off; each still needs native platform acceptance.

Delivered:

  • Rule fencing at settlement (4.2): under the Session settlement lock each delivered project rule is checked again against the Location's current approval (checkout root, generation, digest). A revocation between discovery and commit neither delivers nor consumes the rule (a_rule_revoked_while_its_read_settles_is_neither_delivered_nor_consumed).
  • Restart and replay (4.2/4.4): delivered rules stay consumed after a server restart, a read cut off by restart consumes nothing, and an approval withdrawn while the server was down holds the rule (three *_restart tests in crates/cyber-app/tests/instructions.rs).
  • Inspection (4.3): /context and GET /sessions/{id}/context list up to 128 delivered rules with current/changed/revoked/unknown approval, and withheld rule definitions by reason (trust_held, read_denied, invalid_frontmatter, compat_disabled, bound_exceeded), without opening them. OpenAPI/SDK regenerated.
  • Doctor (4.1/4.3): the instructions check counts scoped rules without adding them to the baseline and lists withheld definitions by reason, honouring compat.claude.
  • Leakage, precedence, truncation and token consistency (4.4): worktree moves, child/forked Sessions, budget-truncated reminders, and last_prepared_request rebuilt exactly from the provider's actual request body.
  • JSONL replies (6.4): stale, wrong-kind and cross-driver replies are refused as protocol errors while the run continues.
  • Secret-safe JSONL lines (6.3): error/result/end error fields pass through the built-in redactor.
  • --include-hook-events (6.3): hook_event lines from durable hook receipts for tool calls of the driver's own prompts.
  • Descendant ownership (6.2/6.4): child-Session requests carry root_session_id/root_input_message_ids when every link is a running background subagent Job; the driver claims, answers and drains those and PreToolUse hook asks. Bug fixed with a regression test: *.replied events carry request_id, so a request answered elsewhere was never dropped from the driver's asks.
  • Scoped interruption (6.2): interrupt also stops an owned background subagent subtree; a mixed-cohort child stays running and is reported unknown.
  • Docs (7.1): docs/features.md and docs/local-core-guide.md reconciled with the above; docs/cli.md, sdk/openapi.json and the generated SDK verified current.

Still open in code: withdrawing a rule already delivered in the current Epoch after revocation or change (inspection only reports it); withheld non-rule instruction files as typed entries; foreground-subagent ownership; acknowledged interruption of a subagent with an in-flight tool call; Session-scoped and descendant hook receipts; user-configured redaction patterns on JSONL lines; the raw provider message in session.step.failed.

Externally blocked:

  • Decision: how a revoked or changed delivered rule leaves the active context (elide on replay vs. force an Epoch rebuild or compaction).
  • Decision: whether an attached JSONL driver continues across a server restart.
  • Decision: the removed-Location maintenance and construction-evidence cleanup protocol revision (outside the 3.0 approval).
  • Decision: enabling default managed Git source admission.
  • Native platform CI (macOS Intel/ARM, Linux x64/ARM, Windows host) on the final pushed source for 4.1–4.4, 5.4, 6.2–6.4 and the managed-recovery tasks, then whole-branch review and task check-off.

Recovery continuation 2026-11-14 (2)

Issue #93 managed-recovery increments. Evidence is local macOS arm64 only; no task was checked off and no platform acceptance is claimed.

Delivered:

  • 3.4 non-Git acceptance (d24eb6a1): a non-Git rename restored as delete plus create (owner edit to the new name refuses the restore; unrelated edits kept), FIFO and Unix-socket entries reported unsupported and never touched, an editor write between two replacements refuses the rest and keeps the edit with a retained journal, and a real-binary both rewind over a rename/delete undone with sessions checkout --code.
  • 3.3 cap and retention through real clients (f8c4d7e0): App over HTTP refuses code/both previews over a lowered cap with the cap reason and still commits a conversation-only rewind; the TUI shows the cap line. Cap-pressure capture retires only aged, payload-complete restores; collection keeps staged-undo and inactive-branch roots.
  • M8 file-copy cut matrix (14cb0115): real SIGKILL after the Session writer commit and before the journal acknowledgement (debug-only fixture point, compiled out of release), and inside payload reclamation after the first unlink; both resume without replay, transcript movement or inference. implementation.md now has a per-cut evidence table with gaps marked.
  • M6/M8 managed metadata process death (abcfb0f5): App SIGKILL during paired keep/rollback and prepared-cancellation metadata retirement; maintenance completes the same frozen plan and lookup returns the same receipt.
  • M2/M6/M8 partial construction (0a759e01, 54e13a97): kills between a flushed checkout claim/acknowledgement stage and its publication leave the stage fenced (same-owner unknown constructor) and listed by recovery clients; preparation listing now survives a removed managed worktree (bug fix with regression test, the construction inventory is advisory).
  • Evidence notes (0a71bba1): the removed-Location claim is narrowed to code reading, and the stale M8 note on metadata retirement is corrected.

Note: the --include-hook-events bullet in the previous section is outdated; c0d44613 reverted it here in favour of the add-exec-hook-events change (PR #132).

Still open (2.4, 3.2–3.4, M2–M8 stay unchecked):

  • M8 gaps: no kill directly after a progress write; filesystem-completion cut only for a zero-payload creation; paired keep/rollback writer-commit cut only simulated; no real kill after the ordinary journal acknowledgement and before the HTTP reply; paired/prepared payload reclaim interrupted in-process only; constructor/zero-payload paired/prepared metadata cuts.
  • Device-node case (needs root); native filesystem privacy acceptance.
  • Native results on this source: Linux x64/ARM, macOS Intel/ARM, Windows results/limits; shared Git/binary regressions; the code/security review M8 requires.

Decisions needed from the owner:

  • What GET /sessions/{id}/rewind/recovery (and cyber sessions recovery) should report for a Session whose Location was removed. Today it fails with "No such file or directory"; by code reading main fails the same way, but this was not reproduced by a run on main.
  • The removed-Location maintenance and construction-evidence cleanup protocol revision (outside the 3.0 approval). Until then, construction stages and removed-Location metadata cannot be cleaned up.
  • Enabling default managed Git source admission (unchanged).

Owner decisions 2026-11-15

Each decision is recorded in openspec/changes/complete-daily-coding-surfaces (design.md "Owner decisions 2026-11-15", implementation.md section of the same name, tasks.md) and removed from the "Externally blocked" list; the open questions above about the removed-Location listing, managed Git admission and construction-evidence cleanup are resolved as below. Local macOS arm64 results only.

  1. Revoked or changed delivered rule: elide on replay — 7a80f98e. At the next request boundary one rule_withdrawn system marker records each delivered rule whose approval was revoked or whose definition changed; from that request on its delivered block is elided from earlier tool results (exact match by recorded label/length/SHA-256, fallback to the next label). Stored results are unchanged, no Epoch rebuild or compaction, survives restart. Tests: a_revoked_delivered_rule_is_elided_from_later_requests_and_after_restart, a_changed_delivered_rule_is_elided_from_the_next_request (cyber-app instructions), unit tests in runtime::rule_withdrawal.
  2. JSONL driver across a server restart: structured error, no reconnect — e4419960. The driver emits an error line with code: "server_lost" and resume (session_id and the cyber exec … --session <id> command, never the password), exits 2, and end carries error_code/resume. Test: a_server_restart_under_an_attached_driver_ends_with_a_resume_hint_and_keeps_the_input (real cyber serve killed and restarted while the driver is attached through a proxy already pointed at the new server; the hint resumes the same Session).
  3. Removed Location: recovery listing is orphaned and read-only — 405d3f95. Instead of "No such file or directory", journals recorded for the removed path are listed with location_removed: true (HTTP route, cyber sessions recovery, TUI panel); nothing is locked or deleted and review still fails. OpenAPI/SDK regenerated. Tests: removed_location_lists_its_retained_journals_read_only (cyber-snapshot), removed_location_recovery_lists_retained_journals_as_orphaned (branches_cli), TUI a_removed_location_journal_is_listed_read_only.
  4. Default managed Git source admission stays off (configuration opt-in once the native CI matrix is green) — ec6b2996. Verified off (only the native-git-acceptance build admits it); pinned by managed_git_source_admission_is_off_by_default. The configuration opt-in itself is not implemented.
  5. FIFO test review notes — 51c0c56e. Test renamed to fifo_and_socket_entries_are_disclosed_unsupported_and_never_restored_or_deleted; new a_captured_file_replaced_by_a_fifo_refuses_restore_and_keeps_the_fifo exposed a partial restore (the FIFO's unsupported label was skipped like an ignore and only b.txt was restored). Fixed: an unsupported current entry at a changed path is now a conflict and the whole restore refuses; the FIFO is never opened, deleted or replaced.
  6. Construction-evidence cleanup: OpenSpec first, no code — ba659e34. New change openspec/changes/add-construction-evidence-discard (awaiting owner review): owner-only review/confirm discard of unpublished construction stages, including removed-Location evidence, with an audit receipt, fencing rules and the list of what still refuses.

Verification: cargo fmt --check; Clippy -D warnings --all-targets for cyber-server, cyber-app, cyber-cli (also with native-git-acceptance), cyber-tui, cyber-snapshot; nextest ci: cyber-server lib + http (571), context_compaction, cyber-app instructions (31) and snapshot_reclamation (48), cyber-cli exec_stream_input (34) and branches_cli with native-git-acceptance (33), cyber-tui lib (686), cyber-snapshot all (214); strict OpenSpec (104 items), spec lint 0 errors, spec inventory, SDK --check, OpenAPI current, docs/cli.md unchanged.

Driven runs page GET /sessions/{id}/hook-executions after each owned tool
call settles, at idle and before end, and emit one hook_event line per
settled receipt whose call_id belongs to an owned step, correlated with the
owning inputs. Reads are bounded by page count and run start, receipts are
deduplicated with a bounded seen-set, and hook IO or reasons are never
included. Session-scoped receipts without a call_id are not reported. The
flag needs --input-format stream-json.
A child Session's permission/question request now carries root_session_id
and root_input_message_ids when every link up to the root is a background
subagent Job with one complete, bounded input origin. Scoped attendance,
reply validation and Goal unattended-ask timing use that root cohort, so
only the bound input client keeps the request waiting; mixed, detached or
malformed lineage stamps nothing. OpenAPI and the TS SDK are regenerated.
The root-cohort check accepted any subagent Job row for a parent/child
link, so a child whose background Job had settled kept that stale cohort
for every later request: a foreground resume (which creates no Job) was
stamped with the old input and bound to its client, settling Unattended
on that client's release or letting it answer another input's request.
A link now proves a cohort only through its running Jobs. A settled or
restart-interrupted Job lends nothing; a background resume uses the new
running Job's cohort. Regression tests cover settled Jobs, a foreground
resume after completion and a restart that interrupts the Job.
The driver now claims a permission/question routed to its Session from a
background subagent's child Session when the request's root cohort is
entirely its own pending inputs. The line keeps the run's session_id and
adds request_session_id, replies post to the child Session, the owning
input stays pending while the ask waits, and EOF/end settles it. Another
driver of the same Session neither emits nor answers it. A PreToolUse
hook "ask" is verified to carry its step cohort and be owned like a
direct ask.

Fix: replied events carry request_id, not id, so a request answered
elsewhere was never dropped from the driver's tracked asks; with asks now
holding input slots that would have kept an input pending.
Scoped interruption reported every subagent Job as descendant_job unknown.
A running subagent Job whose complete durable cohort lies within the
selection now has its handback suppressed and its child subtree stopped
through the subtree stop path, when the child is a direct child of the
Session and no Job from outside its bounded (256-Session) subtree targets
it. The Job counts as cancelled only when the stop acknowledges; mixed,
detached or unresolved descendants still report descendant_job unknown.

stop_subtree and close_subtree_admissions gain leased variants so the
interruption worker, which already holds the lifecycle lease, never
re-enters the lifecycle lock behind a pending shutdown.
Update the feature table and local-core guide for settlement-time rule
fencing, restart behaviour, delivered/withheld rule inspection, descendant
and hook ask ownership, scoped subagent interruption and JSONL hook events;
drop stale 'remain open' items and list what is still blocked. Record the
reconciliation in implementation.md and the 7.1 task note.
Reverts 6dda753. The flag is delivered by the separate add-exec-hook-events
change (PR #132), which covers single-prompt and driven runs, Session-scoped
hooks and reused Sessions; keeping both would define the same flag and line
twice. The event/apply split in the driver is kept because later request
tests use it. Task 6.3, the guides and the implementation log now point to
that change.
Add file-copy acceptance tests for a rename restored as delete plus create
(owner edits to the new name refuse the whole restore), FIFO/socket entries
disclosed as unsupported and never opened, recreated or deleted, and an
editor write between two replacements that refuses the rest with a retained
journal. Add a real-binary non-Git both-rewind over a rename and delete,
undone with sessions checkout --code. Record the 3.4 evidence; platform
acceptance stays open.
Lowered-cap HTTP previews refuse code/both with the cap reason while a
conversation-only rewind commits; cap-pressure capture retires only an aged,
payload-complete restore and leaves within-retention evidence untouched;
collection past retention keeps staged-undo and inactive-branch roots and
removes an unreferenced manifest only after journals settle. The TUI rewind
view renders the cap line and the conversation-only hint. Record 3.3 progress.
Add a debug-only process-cut fixture point between the Session writer
commit and the native journal acknowledgement of an ordinary restore
(CYBER_TEST_PROCESS_CUT=ordinary-restore-writer-commit; release builds
compile it out).

Two real-binary branches_cli cases SIGKILL at those boundaries: the
service after the writer commit, and a separate maintenance process
inside the payload deletion transaction after the first unlink. Both
check receipt-only lookup and acknowledgement on restart, unchanged
transcript and inference count, surviving later owner edits, and that
reclamation resumes the exact frozen plan once.

Record the M8 cut matrix in implementation.md mapping each named cut
to existing process-death tests, with the remaining gaps marked.
Generalize the parked metadata-retirement child to ordinary restore, paired
keep/rollback and prepared cancellation. A separate inert child creates the
paired/prepared receipts through a real SIGKILL of the managed restore (partial
source exchange, or prepared identities under SQLite writer contention); a second
child settles them through the real review/confirm routes, reclaims payloads and
parks at the first acknowledgement or claim unlink before being killed.

The parents reopen the Store, check the incomplete version-2 plan and its exact
missing leaves, resume through periodic maintenance with a no-op repeat, and
verify protected Git bytes, Session sequence, later owner links and the same
receipt on explicit acknowledgement. Add the support file to the native filter
and record the M6/M8 evidence.
Kill a real process after the private claim and acknowledgement stages are
flushed and before their no-replace publication. The stage stays
byte-identical, no stable claim or acknowledgement appears, and reuse,
metadata retirement and worktree removal refuse it as same-owner unknown
constructor evidence. A real service kill at the new debug-only
checkout-claim-stage-flushed point shows new input refused until the
pre-effect preparation is cancelled, with the stage still fenced afterwards.
An interrupted cancellation-record stage is never adopted and payload
cleanup refuses it.

Removal used to report these stages as "Invalid activity identity" or
"Unacknowledged checkout construction remains", and `sessions recovery` said
only "No retained restore journals." Removal and retirement now name the
stage and owner; preparation listing gains `checkout_constructions` from a
read-only name inventory (OpenAPI/SDK regenerated), and the CLI text and TUI
recovery panel show it with what cancelling does and does not clear.

The process-cut fixture moves to cyber-core so the claim constructor can use
it. No cleanup authority is added; removing construction evidence needs a
separate protocol extension.
The checkout construction name inventory canonicalizes the Session's managed
Location, so a Session whose worktree was removed (it keeps worktree_id) made
GET /sessions/<id>/rewind/preparations fail, and `sessions recovery` text
exited non-zero through its preparation hint. The inventory is advisory:
a missing Location yields no names (removal refuses while any stage remains),
other inventory errors are logged and yield no names, and the CLI hint is
best-effort with a stderr note.

The foreign acknowledgement-stage test case used a length-mismatched name and
only exercised the malformed path; it now also covers a well-formed stage for
another, unacknowledged owner and asserts the listed owner. The claim-stage
kill fixture stops the registered service before panicking on timeout.

Docs and the spec scenario state which stages recovery clients cannot show
(malformed, unlisted owner, cancelled preparation) and that removal and
retirement refusals still name them.
The removed-Location journal listing failure was verified against main only by
code reading, not a run; say so and record the open product decision. The M8
note still said paired metadata retirement was cut in-process only, which the
App SIGKILL cuts have since covered; only paired/prepared payload cleanup is.
Owner decision 2026-11-15: a rule already delivered in the current Context
Epoch whose approval is later revoked or re-reviewed, or whose definition
changes on disk, is withdrawn at the next request boundary. One
rule_withdrawn system marker records it, and view projection replaces its
delivered block in earlier tool results with a short notice. Stored
results keep their bytes, no Epoch rebuild or compaction is forced, and
replay restores the elision after a restart.

Delivery now stamps each rule binding with its rendered block (label,
length, SHA-256) so the block is elided exactly; redacted or older blocks
fall back to the next instruction label or the reminder end.
Owner decision 2026-11-15: an attached stream-json driver does not
reconnect across a server restart. When its event stream closes it now
writes one error line with code server_lost and a resume object (the
Session ID and the cyber exec command that continues it, with --attach
when attached and never the password), settles waiting inputs as before
and exits 2. The end line keeps its error text and adds error_code and
the same resume object.

The server-crash test now restarts the server while the driver is still
attached through a proxy already pointed at the new server, checks that
nothing is resent, and resumes the same Session with the hinted command.
Owner decision 2026-11-15: journal listing for a Session whose Location
directory was removed failed with "No such file or directory" because the
file-copy namespace key needs the directory identity. When the Location
is NotFound, the listing now scans the bounded namespace set and
attributes a journal only when its recorded path equals the Location and
the namespace key is the digest of that path and the recorded identity.
Matching journals are returned with location_removed: true. Nothing is
locked, created or deleted; review and restore still fail.

The HTTP route, cyber sessions recovery (text marks the rows and drops
the review hint) and the TUI recovery panel (marks the rows, Enter starts
no discovery) all use it. OpenAPI and the SDK are regenerated.
Owner decision 2026-11-15: managed Git source admission stays off until
the native CI matrix is green, and becomes a configuration opt-in after
that. It is off today: owned restore admits a Git Location only in the
native-git-acceptance build. A new test pins that a default build
refuses whatever the configuration says and that snapshots: false
refuses in every build. Record the decision and the default in the
change notes and docs/rewind.md; the configuration opt-in itself is not
implemented.
…ed path

Review notes on the non-regular-entry test: rename it to drop "device"
(no device node is created) and add a case where a captured a.txt is
replaced by a FIFO before restore.

That case exposed a partial restore: with a review taken after the
replacement, the plan treated the FIFO's "unsupported" capture label like
an ignore exclusion, skipped a.txt silently and restored only b.txt. A
changed path that the current capture marks unsupported (FIFO, socket,
device, link or hard-linked file) is now a conflict and refuses the
whole restore; other exclusion kinds keep skipping. The FIFO is never
opened, deleted or replaced; both attempts run under a timeout.
…iew)

Owner decision 2026-11-15: OpenSpec first, no code. Add the change
add-construction-evidence-discard: a two-step owner-only review/confirm
command that discards unpublished checkout-claim, acknowledgement and
cancellation-record stages of one Session, including those left by a
removed Location, with a durable audit receipt written before any
unlink. It defines the fencing (idle Session, exclusive activity
lifetime lock, no published record, unchanged reviewed identity and
digest, local owner only) and what still refuses. Point the managed
recovery notes and the externally blocked list at it.
One stage per confirmation, CLI and API first with the TUI showing the
command, and failed unlinks retried indefinitely and reported as discard
pending while counting toward the snapshot cap.
… proof 90 minutes

The three doctor instruction tests matched reported paths with '/', which
fails on Windows where the paths use '\'. The macOS Intel snapshot proof
took 56 minutes and hit its 60-minute limit twice after the recovery
crash-cut cases were added.
Driven exec runs now follow their Session's event stream, so the hook
receipts from --include-hook-events (#132) would only reach the instance
stream and lose their order against tool_result lines. The Session
stream accepts the same opt-in include=hook_receipts and forwards only
that Session's own receipt summaries; any other include value is a 400.
session_input_event_stream takes the opt-in and the driver passes the
flag through, reconciling the receipt listing when the Session goes idle.

Specs (add-exec-hook-events), OpenAPI/SDK, guide and changelog updated;
the "--include-hook-events is not available yet" note is gone.
@leonardoaraujosantos
leonardoaraujosantos merged commit 9226995 into main Nov 17, 2026
60 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants