Repository navigation
fix(lore-memory): do not mine sessions a program started - #416
Merged
Merged
Conversation
claude -p and Agent SDK runs (Lore's own Find lessons runs among them), codex exec runs, and Codex subagent threads hold prompts a program wrote. The adapters now mark them automated in agent_session.metadata_json from the entrypoint, source, and originator the logs record, and the miner skips them. PARSER_VERSION 19 re-parses existing sessions so they get the mark.
…ay so The mark was set only when a session was first stored, so one a person started and claude -p --resume continued stayed unmarked until a re-parse. Appended lines now set it; nothing clears it.
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.
What
sdk-*entrypoint (claude -p, the Agent SDK). The Codex adapter does so whensession_metarecordssource: "exec", asubagentsource, or originatorcodex_exec.{"automated":true}inagent_session.metadata_json(no migration; the column was always NULL).mem mineand MCPmine_candidates) skips automated sessions.PARSER_VERSION18 → 19 so existing sessions get the mark on the next scan (a one-time full re-parse, like earlier bumps).Why
The miner's only origin filter was
is_sidechain = 0, so every user turn of a scripted run read as the person's words. A short scripted first prompt with a rule phrase ("Make sure you always run tests") is flagged as a rule with no agent turn before it. 40 of 123 Codex first turns in the owner's archive are under the 300-character limit, and Lore's own lessons runs are archived as ordinary sessions. No leak was found in today's data (all 540 receipts come from interactive sessions), so this is preventive.Test
crates/lore-memory/tests/mine_automated.rs: codex exec, subagent, and originator-only sessions, andsdk-cli/sdk-tsClaude sessions yield nothing, while the interactive control (source: cli,entrypoint: cli) still yields its rule and correction. Both tests fail without the miner filter.cargo test --no-fail-fast -p lore-core -p lore-memory -p lorectlpasses; clippy-D warningsclean;scripts/egress-check.shok.