Skip to content

feat(knowledge): implement rollback command and TUI palette#5053

Merged
bug-ops merged 2 commits into
mainfrom
feat/m29/5019-knowledge-rollback-status-tui
Jun 7, 2026
Merged

feat(knowledge): implement rollback command and TUI palette#5053
bug-ops merged 2 commits into
mainfrom
feat/m29/5019-knowledge-rollback-status-tui

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • zeph knowledge rollback --batch-id <id> CLI command deletes graph edges and entities for the given import batch, removes the ledger row, and prompts for confirmation unless --yes / -y is passed
  • /knowledge rollback <id> slash command dispatched via AgentAccess::knowledge_rollback (same logic, agent path)
  • /knowledge status slash command (AgentAccess::knowledge_status) returns ledger summary as formatted text
  • Three TUI command palette entries: KnowledgeStatus (dispatches /knowledge status with spinner), KnowledgeRollbackPrompt (prefills /knowledge rollback ), KnowledgeIngestPrompt (shows CLI instructions)
  • IngestLedger::batch_exists and IngestLedger::delete_batch methods added to zeph-memory (4 unit tests)
  • GraphStore::delete_batch removes edges and orphaned imported entities; conversation-origin knowledge is never touched (2 unit tests)
  • Phase-1 Qdrant warning when edges == 0 && entities == 0 — note is printed before the summary line (CLI) or appended via push_str (agent path); Qdrant vectors remain until Phase 2
  • UTF-8 safe source_uri truncation via floor_char_boundary(40) in agent_access_impl.rs

Test plan

  • cargo nextest run -p zeph-memory -E 'test(batch_exists)' --lib — PASS
  • cargo nextest run -p zeph-memory -E 'test(delete_batch)' --lib — PASS
  • cargo nextest run --workspace --features desktop,ide,server,chat,pdf,scheduler --lib --bins — 11077 PASS
  • cargo +nightly fmt --check — clean
  • cargo clippy --all-targets --features desktop,ide,server,chat,pdf,scheduler --workspace -- -D warnings — no warnings
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — clean
  • zeph knowledge rollback --help shows --batch-id and --yes flags
  • zeph knowledge rollback --batch-id nonexistent exits with "batch not found" error
  • TUI / palette shows knowledge:status, knowledge:rollback, knowledge:ingest entries (live TUI — Qdrant DOWN in CI)

Closes #5019
Closes #5020

@github-actions github-actions Bot added enhancement New feature or request documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate size/XL Extra large PR (500+ lines) labels Jun 7, 2026
@bug-ops
bug-ops enabled auto-merge (squash) June 7, 2026 22:57
bug-ops added 2 commits June 8, 2026 00:57
…5020)

Closes #5019, Closes #5020.

Rollback:
- IngestLedger: add batch_exists() and delete_batch() to query and
  remove ledger rows by import_batch_id
- GraphStore: add delete_batch() to remove imported edges and orphaned
  entities stamped with the given import_batch_id; conversation-origin
  rows are never touched
- CLI: add --yes/-y flag to `zeph knowledge rollback` to skip the
  interactive confirmation prompt
- handle_rollback: real async implementation replacing the Phase-1 stub;
  verifies batch exists, prompts for confirmation, deletes graph rows
  and ledger entries, warns when 0 graph rows removed (Phase-1 notes
  sink writes to Qdrant, not the graph)

Slash command / agent integration:
- AgentAccess: add knowledge_status() and knowledge_rollback() trait
  methods with implementations in agent_access_impl.rs
- KnowledgeSlashCommand: /knowledge [status | rollback <batch_id>]
  registered in the command registry
- knowledge_status: safe UTF-8 source_uri truncation via
  floor_char_boundary

TUI palette (spec-067 §8):
- TuiCommand: KnowledgeStatus, KnowledgeRollbackPrompt,
  KnowledgeIngestPrompt variants
- build_knowledge_commands(): 3 palette entries under the knowledge
  category
- handle_knowledge_command(): dispatches status via /knowledge status
  slash command (with spinner), prefills rollback input
@bug-ops
bug-ops force-pushed the feat/m29/5019-knowledge-rollback-status-tui branch from 2866fb8 to 9162fce Compare June 7, 2026 22:57
@bug-ops
bug-ops merged commit 1f65ab1 into main Jun 7, 2026
35 checks passed
@bug-ops
bug-ops deleted the feat/m29/5019-knowledge-rollback-status-tui branch June 7, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

knowledge ingest: TUI palette + status spinner for knowledge commands knowledge ingest: knowledge rollback + knowledge status commands

1 participant