Skip to content

Finish interrupted chat deletions on every server - #764

Merged
sambitcreate merged 22 commits into
feature/sm-serve-framingfrom
feature/sm-serve-chat-recovery
Nov 6, 2026
Merged

sambitcreate merged 22 commits into
feature/sm-serve-framingfrom
feature/sm-serve-chat-recovery

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

Moves tombstone recovery from createCliRemoteChats to recoverChatDeletions, so every server runs it.

  • Inventory: C14
  • Unchanged: the daemon-chat-deletions.json format, step order, tombstone removed last. Remote still fails startup if a deletion is stuck.

Defect fixed: aiden serve --no-remote neither finished a committed deletion nor closed the chat to new turns.

packages/cli/README.md is updated.

Shared contracts: no persistence, wire-format, protocol revision, telemetry, network or runtime-flag change. Nothing outside packages/cli, docs/state-machines and .memory changed, so the iOS and Android suites were not run.

Worksheet: docs/state-machines/serve-daemon.md.

🤖 Generated with Claude Code

sambitcreate and others added 7 commits November 4, 2026 20:07
Tombstone replay lived in createCliRemoteChats, so aiden serve --no-remote
neither completed a committed deletion nor closed that chat to new turns.
The daemon now closes tombstoned chats at construction and recovery runs at
serve startup. A failure closes only those chats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A save read its file after consent without comparing it to what was reviewed,
and new-task consent stayed valid until expiry because only the retired
producer removed its receipt. No caller in src produces consent today, so
this hardens the guard that remains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-memory spent list covers one scheduler. Separate offline commands build
their own, so a receipt left on disk could be replayed through a new one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

This PR can reopen and remotely serve a chat whose committed deletion tombstone is malformed or unreadable.

Reviewed changes I reviewed the daemon-wide relocation of interrupted chat deletion recovery, its Remote startup interaction, and the new behavioral coverage and documentation.

  • Daemon-wide recovery — createDaemonChats now captures tombstones, gates affected chat IDs, and owns repeatable roll-forward cleanup for every server mode.
  • Startup behavior — serveOwned attempts recovery for all servers, while Remote retries it and still rejects startup when a valid tombstone cannot be completed.
  • Coverage and docs — CLI tests cover no-Remote recovery and retry after a cleanup fault, and the README and serve state-machine worksheet document the new behavior.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread packages/cli/src/daemon-chats.ts Resolved
sambitcreate and others added 8 commits November 4, 2026 20:34
A malformed record was logged and treated as no pending deletions, so a chat
whose deletion had committed could reopen. Remote used to reject this state.
Every chat now stays closed and no server starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A structurally malformed deletion record can still let a no-Remote server start with chat admission open.

Reviewed changes I reviewed the fail-closed tombstone fix and the base synchronization added since the prior Pullfrog review.

  • Fail-closed tombstone reads — Retained unreadable and non-array record failures, closed all turn admission in that state, and rejected startup before ingress.
  • Regression coverage and docs — Added a malformed-JSON startup test and documented the all-chat closure and startup refusal behavior.
  • Base synchronization — Merged the latest feature/sm-serve-framing changes while preserving this PR's six-file recovery scope.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread packages/cli/src/daemon-chats.ts Resolved
sambitcreate and others added 5 commits November 4, 2026 20:48
The receipt survived until the command returned, so a process that died after
publishing left it for a new scheduler to replay. It is now removed just
before the first write publishes. Adds coverage of the follow-on phase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the tombstone-validation fix and base synchronization added since the prior Pullfrog review.

  • Tombstone entry validation — Required every persisted deletion-record entry to be a string before installing per-chat gates, so structurally invalid records now close all admission and block startup.
  • Regression coverage — Expanded the fail-closed behavioral test to cover malformed JSON, non-array JSON, and arrays containing non-ID values.
  • Base synchronization — Merged the latest feature/sm-serve-framing changes while preserving the effective six-file recovery scope.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

sambitcreate and others added 2 commits November 4, 2026 21:00
Forced removal hid a receipt deleted just after the last check, so the write
still published. A missing receipt now stops it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onsent

Give schedule consent one phase and bind it to the review
@sambitcreate
sambitcreate merged commit 3d362d5 into feature/sm-serve-framing Nov 6, 2026
3 checks passed
@sambitcreate
sambitcreate deleted the feature/sm-serve-chat-recovery branch November 6, 2026 07:48

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the schedule-consent merge added since the prior Pullfrog review.

  • Hardened one-shot consent — Modeled approval state as first_write, follow_on, or terminal closed, consumed the durable receipt before first publication, and preserved revocation at the publication boundary.
  • Bound saves to reviewed input — Compared the live schedule JSON with the approved proposal before resolving and persisting the task.
  • Expanded behavioral coverage and records — Added eight focused cases for substitution, reuse, expiry, cancellation, authority changes, receipt races, crash replay, and follow-on checks, and documented the C15 state machine and remaining inventory dispositions.
  • Verified the final head — npm run build and node --test tests/schedule-consent.test.mjs passed locally, with all 8 focused tests passing.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

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