Skip to content

Keep partial writes atomic, fill missing journal entries, and pick the true latest revision - #17

Merged
hyperdrivebeep merged 1 commit into
mainfrom
public-20261023
Oct 22, 2026
Merged

hyperdrivebeep merged 1 commit into
mainfrom
public-20261023

Conversation

@hyperdrivebeep

Copy link
Copy Markdown
Owner

Journal supplement on replay

  • A request stored as completed whose checkpoint, notifications or operation.succeeded event
    were not written (for example the process stopped right after completion) now gets the
    missing entries filled when the same request is replayed in local mode. This applies only
    to 20 measured commands; the handler is not run again, entries are written once in one
    transaction with the actual time and a supplemented mark, and nothing is written if the
    chain or stored data is not in a known shape. A per-operation gate prevents a concurrent
    writer and a replay from filling the same tail. Hosted review mode is unchanged.

No half-written records

  • memory/validate, memory/changeSet/propose and memory/retire/propose write their two MEMORY
    control records in one short transaction, so a failure on the second write leaves no row.
  • R2 closed-loop failures write the sandbox rejection and the research-test hold together,
    after the sandbox work has finished. A final non-retried failure writes completion,
    admission and recovery candidate in one outer transaction. Retry, plain and success paths
    keep their boundaries, and no transaction is held while the sandbox runs or across an
    await. SandboxService.accepting_observation gains an opt-in defer_rejection keyword
    (default unchanged).

Clear message when only the reference step fails

  • When research was committed but the later reference step failed, the error now says, in
    Korean and English, that the research (in v2: its intermediate records) was saved, gives
    the reason, and asks the user to check the saved result before sending the same question
    again. data.research_saved is true. The notice appears only after the research commit is
    proven readable for this project, thread and request; otherwise the previous error is
    returned. Error codes, reason_code and the recorded exception type are unchanged.

Current revision under clock changes

  • Stores chose the current revision by created_at, so a newer revision written while the
    system clock had moved back lost to an older one (18 of 19 checked tables). All affected
    writers append rows, so the current revision is now the last stored one: plan executions
    and outcome series by their revision number then rowid, control records by version then
    rowid (read and latest list), and the other tables by rowid. Schema, writers, canonical
    heads and history lists are unchanged; the thread checkpoint list keeps its display order
    while pause/resume guards use the real latest checkpoint. Two control-record revisions
    with the same version can still be written concurrently; the choice is now deterministic.

Verification: full suite on the exact tree - Python 5503 tests (0 failures, 0 errors,
2 skipped), web tests, lint, typecheck and build, ruff, architecture and module budget
checks, and the README quick-start smoke test all pass.

…e true latest revision

Journal supplement on replay
- A request stored as completed whose checkpoint, notifications or operation.succeeded event
  were not written (for example the process stopped right after completion) now gets the
  missing entries filled when the same request is replayed in local mode. This applies only
  to 20 measured commands; the handler is not run again, entries are written once in one
  transaction with the actual time and a supplemented mark, and nothing is written if the
  chain or stored data is not in a known shape. A per-operation gate prevents a concurrent
  writer and a replay from filling the same tail. Hosted review mode is unchanged.

No half-written records
- memory/validate, memory/changeSet/propose and memory/retire/propose write their two MEMORY
  control records in one short transaction, so a failure on the second write leaves no row.
- R2 closed-loop failures write the sandbox rejection and the research-test hold together,
  after the sandbox work has finished. A final non-retried failure writes completion,
  admission and recovery candidate in one outer transaction. Retry, plain and success paths
  keep their boundaries, and no transaction is held while the sandbox runs or across an
  await. SandboxService.accepting_observation gains an opt-in defer_rejection keyword
  (default unchanged).

Clear message when only the reference step fails
- When research was committed but the later reference step failed, the error now says, in
  Korean and English, that the research (in v2: its intermediate records) was saved, gives
  the reason, and asks the user to check the saved result before sending the same question
  again. data.research_saved is true. The notice appears only after the research commit is
  proven readable for this project, thread and request; otherwise the previous error is
  returned. Error codes, reason_code and the recorded exception type are unchanged.

Current revision under clock changes
- Stores chose the current revision by created_at, so a newer revision written while the
  system clock had moved back lost to an older one (18 of 19 checked tables). All affected
  writers append rows, so the current revision is now the last stored one: plan executions
  and outcome series by their revision number then rowid, control records by version then
  rowid (read and latest list), and the other tables by rowid. Schema, writers, canonical
  heads and history lists are unchanged; the thread checkpoint list keeps its display order
  while pause/resume guards use the real latest checkpoint. Two control-record revisions
  with the same version can still be written concurrently; the choice is now deterministic.

Verification: full suite on the exact tree - Python 5503 tests (0 failures, 0 errors,
2 skipped), web tests, lint, typecheck and build, ruff, architecture and module budget
checks, and the README quick-start smoke test all pass.
@hyperdrivebeep
hyperdrivebeep merged commit d4d39ed into main Oct 22, 2026
1 check 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.

1 participant