Skip to content

feat(acp): add opt-in durable session binding store - #6682

Closed
KLari1994 wants to merge 3 commits into
block:mainfrom
KLari1994:feat/PAN-3-session-store
Closed

KLari1994 wants to merge 3 commits into
block:mainfrom
KLari1994:feat/PAN-3-session-store

Conversation

@KLari1994

Copy link
Copy Markdown

Summary

Adds an opt-in SQLite session-binding and processed-event store to buzz-acp so a stored ACP session can survive harness restart, duplicate relay event IDs produce one reply, and invalid bindings are discarded instead of silently forking history.

Default remains in-memory. Set --session-store PATH or BUZZ_ACP_SESSION_STORE to enable. The store holds IDs and timestamps only.

Closes PAN-3.

Why

Session maps lived only in memory. A restart always called session/new and forked history. Event dedupe was also in-memory, so a re-REQ after restart could prompt twice.

What landed

Branch feat/PAN-3-session-store on pinned main 0720f5380ce8a6c050afac159f8462c06cd51ab5.

Commits (DCO-signed):

  • 5b3fdcd5b feat(acp): add durable session binding store
  • a18e48d13 fix(acp): scope session bindings per worker and harden restore
  • c11e582ec fix(acp): drop bindings on idle model switch and retire sibling keys

HEAD: c11e582ec17293f0036f4363e1b26d2fdde86c71
Diff: 10 files, +2374 / -39, crates/buzz-acp plus mechanical root Cargo.lock.

New:

  • crates/buzz-acp/src/session_store.rs
  • crates/buzz-acp/src/session_store/sqlite.rs
  • crates/buzz-acp/tests/session_store_restart.rs

Changed: config.rs, acp.rs, pool.rs, lib.rs, queue.rs, Cargo.toml.

Behavior:

  • Restore uses ACP session/load only when the adapter advertises loadSession. Failure or missing capability deletes the binding and warns, then creates a fresh session.
  • Bindings are worker-scoped. A fresh channel create retires sibling-worker keys first.
  • Processed events are marked only after a successful turn.
  • Store errors never take the harness down.
  • No Pantheon names. IDs and timestamps only.

Verification

Independent gate: cargo test -p buzz-acp session_store, cargo test -p buzz-acp pool, cargo test -p buzz-acp, cargo fmt --all --check, cargo clippy -p buzz-acp --all-targets -- -D warnings all exit 0 at 2026-08-24T10:17:02Z.

This is a generic upstreamable seam. Hosts must pass a stable store path; Desktop/gateway launcher wiring is out of scope.

Add an opt-in SQLite-backed session-binding and processed-event store
so ACP sessions survive harness restarts and duplicate relay event IDs
produce one reply. Bindings store IDs and timestamps only.

Testing:
- cargo test -p buzz-acp session_store -- --nocapture
- cargo test -p buzz-acp pool -- --nocapture
- cargo test -p buzz-acp
- cargo fmt --all --check
- cargo clippy -p buzz-acp --all-targets -- -D warnings

Signed-off-by: Kelcee Lari <kelcee.lari@gmail.com>
Address Fable PAN3-R1..R3 on the durable session store: worker-scoped
binding keys, git-origin MCP env on session/load, and delete bindings on
for-cause invalidate while keeping restart payload on AgentExited.

Signed-off-by: Kelcee Lari <kelcee.lari@gmail.com>
Address Fable r2 PAN3-R1/R2: idle SwitchModel now removes channel
bindings, and a fresh session/new retires every worker key for that
channel before save_binding.

Signed-off-by: Kelcee Lari <kelcee.lari@gmail.com>
@KLari1994
KLari1994 requested a review from a team as a code owner August 24, 2026 10:38
@KLari1994

Copy link
Copy Markdown
Author

Pantheon / PAN-3 — merge assistance request

This PR is the complete implementation for Linear PAN-3 (durable opt-in buzz-acp session binding store).

  • Head: c11e582ec17293f0036f4363e1b26d2fdde86c71 (3 DCO-signed commits)
  • Base: main @ 0720f5380ce8a6c050afac159f8462c06cd51ab5
  • Local independent gate: cargo test -p buzz-acp / fmt / clippy -D warnings all green
  • Author association: NONE — KLari1994 has pull-only on block/buzz (push=false), so we cannot merge or satisfy admin branch-protection ourselves
  • mergeable=true, mergeable_state=blocked (branch protection / required checks/reviews)

Could a maintainer please review + merge (squash OK), or advise the preferred contributor path?

Thanks — Syntropic/Pantheon integration is serial-blocked on this landing.

@KLari1994

Copy link
Copy Markdown
Author

Follow-up: CI is waiting on maintainer workflow approval

Re-checked head c11e582ec17293f0036f4363e1b26d2fdde86c71:

Surface Result
DCO Check success
CI completed / action_requiredhttps://github.com/block/buzz/actions/runs/32717764216
Docker image action_required — https://github.com/block/buzz/actions/runs/32717764208
Mesh Lifecycle action_required — https://github.com/block/buzz/actions/runs/32717764224
Desktop Release Candidate action_required — https://github.com/block/buzz/actions/runs/32717764206
mergeable_state blocked
KLari1994 perms on block/buzz pull only (push=false)

For first-time contributors from forks, GitHub often holds Actions until a maintainer clicks Approve and run workflows. After CI is green, a maintainer merge (squash OK) unblocks Pantheon PAN-3.

Local verification already green: cargo test -p buzz-acp + fmt + clippy -D warnings.

mfethe1 added a commit to mfethe1/buzz that referenced this pull request Aug 24, 2026
…hardening)

Cleaned integration branch, not a raw PR head:
- base: block#6682 SQLite/WAL store + durable processed_events dedupe
- ported: block#6088 owner-only 0600/0700 perms + repair-on-open
- 2 new regression tests assert file MODE (negative control: 7/2 fail without)

Source branch: integration/session-store (based on origin/main f6e6617)
mfethe1 added a commit to mfethe1/buzz that referenced this pull request Sep 2, 2026
…WAL + processed_events)

Base chosen over block#6088 on verified grounds:
- block#6682 merges clean vs origin/main (merge-tree rc=0); block#6088 conflicts (rc=1)
- block#6682 durably dedupes relay events (processed_events table); block#6088 leaves
  duplicate-after-restart unguarded (queue.rs untouched)
- block#6682 has worker-slot keying (ContextKey::for_worker); block#6088 has a flat
  channel->session map with no worker discriminator

Upstream base: f6e6617. PR head: c11e582

Signed-off-by: Michael Fethe <mfethe1@gmail.com>
mfethe1 pushed a commit to mfethe1/buzz that referenced this pull request Sep 2, 2026
…ed from block#6088)

block#6682 opens the SQLite store with a bare Connection::open, leaving the DB at
the process umask (commonly 0644 = world-readable). Bindings are not secrets
but they name channels, agent pubkeys and workspace paths.

Ported block#6088's permission discipline onto block#6682's SQLite base:
- store directory created 0700
- database created 0600 BEFORE SQLite opens it, so its bytes are never
  briefly world-readable (SQLite derives -wal/-shm modes from the main file)
- an existing loose-permission store is REPAIRED on open, so the fix reaches
  deployments created before this landed

Two regression tests assert the MODE, not the content. block#6682's shipped
session_store_file_contains_ids_only passes even when the file is
world-readable, so it cannot catch this class of regression.

Negative control: removing the hardening fails exactly these 2 tests
(7 pass / 2 fail); restoring returns 9/9.

Upstream base: f6e6617
block#6682 head: c11e582
block#6088 reference: session_store.rs:324 (0o600), :350 (0o700), :520-521 (test)

Signed-off-by: Michael Fethe <mfethe1@gmail.com>
mfethe1 added a commit to mfethe1/buzz that referenced this pull request Sep 2, 2026
…hardening)

Cleaned integration branch, not a raw PR head:
- base: block#6682 SQLite/WAL store + durable processed_events dedupe
- ported: block#6088 owner-only 0600/0700 perms + repair-on-open
- 2 new regression tests assert file MODE (negative control: 7/2 fail without)

Source branch: integration/session-store (based on origin/main f6e6617)

Signed-off-by: Michael Fethe <mfethe1@gmail.com>
@KLari1994 KLari1994 closed this by deleting the head repository Sep 12, 2026
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