Repository navigation
Conversation
Wiring
This is the "one branch changed, siblings silently keep the old behaviour" shape: Minor: Unverified / please confirm: the gap, both hook counts and the fix come from running the table on head |
ba014e6 to
e2d59c4
Compare
|
Addressed the automated review finding in
Confirmed your unverified point: Verification on the new head:
Whole-directory run |
1. What I checked beyond the line itself, since the contract is "every deletion path notifies": the gate is the transaction's boolean return, not a row count, and Worth stating for the other six paths: they key off the same "did this transaction actually remove the row" condition rather than a blanket unconditional fire, so an idempotent re-delete stays silent instead of emitting a phantom delete. That is the behaviour a plugin holding per-session on-disk state needs — a duplicate That was the whole of my report on this PR. Nothing outstanding, no residual, and I have no objection to the other six paths as they stand. |
|
Related integration use case for this generic hook: an opt-in external plugin pairs a messaging thread with Desktop session history and removes its own proven-owned temporary files when the user deletes that conversation. I am not proposing that this policy or a vendor-specific cleanup engine be added to core. Reviewing head e2d59c4, the post-commit, fail-open notification and exact cascaded deleted IDs are useful. There are additional contracts needed before this observer can safely drive external deletion:
Would you prefer these as a follow-up generic extension rather than expanding this PR? Keeping the current notification PR focused seems reasonable. Happy to contribute a focused follow-up with rollback/no-op, profile isolation, prune-vs-user-delete and cross-process tests. A separate Desktop deletion-visibility fix is being prepared independently; no competing on_session_delete PR is intended. |
|
Thanks for the careful pass. Agree with keeping this PR focused -- the observer contract stands on its own, so I'd rather not fold the external-consumer contracts into it. On (3): pushed a docs clarification in On (1) and (2): both read as the right follow-up scope -- authoring the provenance distinction (explicit user deletion vs retention/sweep/compensation) and a pre-deletion identity/preparation surface. If you take that follow-up (rollback/no-op, profile isolation, prune-vs-user-delete, cross-process tests), happy to review it; I won't open anything competing here. Noted re the separate Desktop deletion-visibility fix -- no overlap from my side. |
|
Thanks — I am preparing an independent, draft follow-up against current main (no duplicate on_session_delete implementation). Proposed narrow contract: actual REST/RPC delete callers explicitly mark user intent; within the guarded delete transaction core snapshots only exact session/routing identifiers, and an optional preparation hook can stage plugin-owned pending work. A small generic committed deletion receipt, read through a supported SessionDB API, would let a different gateway process confirm that pending work committed, including after a backend crash; plugins retain ownership checks, retry/cursor state and external actions. No message content, vendor policy, veto on the existing post-commit observer, or exactly-once external guarantees. Unknown/maintenance/compensation/profile-move paths would not authorize external cleanup. Maintainer design question: is a generic transactional receipt plus preparation hook acceptable, or would you prefer plugin-owned durable receipts with an explicitly constrained transactional writer surface? I will keep this draft pending that decision and include rollback/no-op, guarded/cascaded IDs, profile isolation and real cross-process tests. |
|
Published the focused independent draft follow-up: #135513 (head 4808cab, base main). @Finn763, your offered review would be welcome. The draft implements caller-authored REST/RPC user intent plus transactionally prepared minimal routing identities and public committed-receipt reads for a plugin-owned durable cross-process ledger. I intentionally did not execute an arbitrary preparation callback inside the SQLite write transaction: re-entrant DB access and external actions before rollback would be unsafe without a constrained contract. The maintainers’ concrete decision is whether this small generic receipt store/read surface is preferable to a constrained transactional writer callback, and what receipt-retention/consumer coordination policy is required. Focused checks: 93 tests passed, 8 RPC deletion neighbors passed, and all 11 blocking lint checks passed. Broad state-suite verification is incomplete and had failures (representative failures reproduced on unchanged base); draft limitations are explicit. No duplication or veto changes to your post-commit observer, no vendor policy, runtime deployment or exactly-once external guarantee. |
cace3e6 to
b79c86e
Compare
|
@Finn763 your two commits landed verbatim in #140995 (merged at 627ce03) with authorship kept: ee3ce9a (state-layer hook on every delete path) and 9949552 (process-local delivery docs). On top of them, #140995 added:
Thanks for the groundwork. |
Adds the on_session_delete post-commit observer requested in #124511 so plugins with per-session on-disk state stop inferring deletion by diffing the filesystem against core's private schema.
Mechanism: new late-bound seam emit_session_deleted() in hermes_state_common.py (function-local import of hermes_cli.lifecycle.notify_session_deleted, fail-open) fired after the write commit in delete_session, delete_session_if_empty, delete_sessions, delete_empty_sessions (reason empty_sweep), prune_sessions (reason prune), and prune_empty_ghost_sessions (reason ghost_prune). Gateway never-active prune is covered via delete_session. One invocation per operation; deleted_ids rides along only when the count differs from 1. Registered in VALID_HOOKS plus the hooks sample-payload map; unbounded caller-thread dispatch like on_session_finalize. EN docs tables plus section; zh-Hans table rows mirrored.
RED-to-GREEN: repro asserting delete_session fires the hook failed on origin/main (hook absent from VALID_HOOKS, no dispatch); passes after. tests/hermes_state/test_session_delete_hook.py: 7 passed. Neighbors: TestDeleteAndExport, test_session_boundary_hooks, test_lifecycle: 11 passed.
Risks: new observer adds one fan-out per delete op; failing callbacks are logged and skipped and can never break deletion. No signature changes; no veto semantics.
Relations: Related to #123272 (transcript scrub on dashboard/gateway deletes covers overlapping call sites). Closes #124511.