fix(core,memory): correct write-time provenance and audit gating in MemGhost consent gate#6599
Merged
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 20, 2026 18:12
bug-ops
force-pushed
the
fix/6556-memghost-source-kind-mislabel
branch
from
July 20, 2026 18:29
4f7f3b3 to
32cadf3
Compare
…emGhost consent gate Batched tool-output writes recorded source_kind via a lossy heuristic keyed only on aggregated trust level, mislabeling MCP, A2A, memory-retrieval, and channel-message batches as web_scrape in the audit log and messages.source_kind. sanitize_tool_output now returns the real ContentSourceKind alongside trust level, and it is tracked and persisted directly instead of re-derived. consent_gate.audit_all was honored on the background tool-output write path but not on the interactive memory_save path, so setting it to false did not suppress interactive audit entries as documented. MemoryToolExecutor now gates its audit block on audit_all consistently with the background path, wired through all four entry points. Also adds direct test coverage for the disclosure-note branch, which previously had none. Closes #6556 Closes #6559 Closes #6557
bug-ops
force-pushed
the
fix/6556-memghost-source-kind-mislabel
branch
from
July 20, 2026 18:32
32cadf3 to
cb26f4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three follow-up defects in the MemGhost write-time memory-consent gate (PR #6544 / issue #6490), all in the same zeph-core memory persistence path:
Agent::sanitize_tool_outputcomputed the accurateContentSourceKindper tool call but discarded it at the return boundary. The batched write path (tier_loop.rs) then re-derivedsource_kindfrom the aggregated trust tier alone via a lossy 2-bucket heuristic, mislabeling any batch containing MCP, A2A, memory-retrieval, or channel-message output as"web_scrape"inmessages.source_kind, the Qdrant payload, and thememory_writeaudit-log entry. Live-reproduced in CI cycle ci-1440. Fixed by threading the realContentSourceKindthroughprocess_one_tool_result(newbatch_source_kind, tie-break: later call wins on equal trust tier) into the persisted write.consent_gate.audit_all = falsewas honored on the background tool-output write path but not on the interactivememory_savepath, so the documented "suppresses audit regardless of trust tier" contract only held for half of the write paths.MemoryToolExecutorgained anaudit_allfield wired through all 4 production entry points (runner.rs,acp.rs,daemon.rs,serve/agent_factory.rs).persist_message_inner(in-turn channel note for autonomous untrusted writes) had no direct test coverage, unlike its sibling audit-log branch.12 new regression tests added, including two adversarial-critique-driven additions: an
audit_all=falsecase proving disclosure/audit independence, and an inverse call-order case proving the tie-break doesn't regress on reversed batch order.Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 14923 passed, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace)gitleaks protect --staged.local/testing/playbooks/memory-consent.mdupdated with scenarios 11-12 covering these fixes.local/testing/coverage-status.mdrow updated in placeCloses #6556
Closes #6559
Closes #6557