Skip to content

fix(sync): preserve shutdown changes and exact peer status - #4

Draft
maphew wants to merge 10 commits into
docs/local-first-multi-machine-syncfrom
agent/pr731-correctness
Draft

fix(sync): preserve shutdown changes and exact peer status#4
maphew wants to merge 10 commits into
docs/local-first-multi-machine-syncfrom
agent/pr731-correctness

Conversation

@maphew

@maphew maphew commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Makes the final watcher shutdown rediscover filesystem changes that are still inside the debounce window before artifact export. Peer status now compares the latest checkpoint's exact session-to-manifest mapping with durable import provenance, so trashed-but-landed sessions remain synchronized while stale or unrelated rows remain pending.

The changes live on an independent side branch targeting the artifact-sync feature branch and do not update kenn-io/agentsview#731 directly.

maphew and others added 10 commits July 10, 2026 17:57
Squashed follow-up changes:
- fix(artifact): baseline curation of trashed sessions at opt-in
- fix(artifact): roll back curation when metadata append fails
- fix(artifact): delete corrupt bucket objects on pull so S3 self-heals
- docs: design secure artifact S3 endpoints
- docs: close S3 redirect downgrade gap
- docs: plan secure artifact S3 endpoints
- fix(artifact): secure S3 transport boundaries
- test(artifact): tighten S3 security assertions
- docs: explain S3 endpoint security policy
- docs: clarify S3 corruption handling by scheme
- docs: qualify S3 self-healing behavior
- fix(artifact): pin insecure S3 override semantics
- docs: design HTTP peer redirect rejection
- docs: plan HTTP peer redirect rejection
- fix(artifact): reject HTTP peer redirects
- test(artifact): bound redirect source capture
- docs: document peer redirect boundary and remove plans
- fix(sync): harden artifact consistency boundaries
- fix(sync): persist origin and heal invalid manifests
- fix(sync): preserve provenance and retry state
- fix(postgres): converge importer-first origin upgrades
- fix(postgres): retain source state during consolidation
- fix(sync): preserve remote history and purge durability
- fix(server): serialize session lifecycle publication
- fix(sync): harden artifact import and retention
- fix(sync): cap artifact allocation amplification
- fix(sync): bound nested artifact collections
- fix(server): serialize curation publication
- fix(artifact): harden sync boundaries
- fix(sync): harden peer artifact convergence
- fix(artifact): confine GC and recover deferred imports
- fix(artifact): publish local sessions from HTTP peers

Co-authored-by: Wes McKinney <wesmckinn+git@gmail.com>
Artifact imports can add metadata conflicts while a reader keeps the same session open. Caching conflict results only by session ID prevented live session refreshes from exposing those conflicts until navigation or reload.

Keep asynchronous stale-response protection while treating each refreshed session snapshot as an opportunity to reload conflict state.

VALID (fixed): #1 -- same-ID session refreshes now refetch metadata conflicts.
INVALID (dismissed): none.
PEDANTIC (skipped): none.
Watcher change bursts and startup already synchronize local session data, so repeating full discovery before artifact publication made incremental updates archive-sized. Keep the periodic floor as the coverage path for unwatched roots while preserving signal flushing on every export.\n\nPin metadata publication only needs a message ordinal and source UUID. A backend-parity point lookup prevents one pin or unpin from materializing the full transcript and its tool data while the lifecycle lock is held.
Periodic PG pushes previously scanned and allocated every historical artifact-import state before determining whether any sessions needed consideration. Large replicated archives therefore imposed work even on no-change watch ticks.\n\nDerive exact provenance keys only after the candidate window is assembled and resolve them through bounded primary-key batches. Empty candidate windows now avoid provenance I/O entirely.
Importer-first artifact convergence rewrites reverse references before deleting a legacy duplicate. Without reverse indexes, every duplicate forced full scans of sessions, tool calls, and tool-result events inside the push transaction.\n\nCreate the indexes after column migrations so both new and legacy schemas can accelerate consolidation safely.
Identity preparation previously issued serialized owner lookups for each candidate and repeated many of them during alias and relationship resolution. The latency dominated full pushes to remote PostgreSQL even when later fingerprint comparison skipped the session.\n\nPreload every candidate, legacy-prefix, canonical, and alias owner in one array query. Cache both rows and absences for the full push so out-of-window relationship lookups are queried at most once.
@wesm
wesm force-pushed the docs/local-first-multi-machine-sync branch 3 times, most recently from cc88a44 to c3be274 Compare July 22, 2026 20:34
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