add agent prompt history sqlite table#12208
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a SQLite-backed agent prompt history store, loads it into an in-memory prompt-history model, captures submitted agent prompts, and uses those prompts for NLD history matching behind the new nld_prompt_history_match feature. No approved spec context was available for implementation-vs-spec validation.
Concerns
- The new prompt-history persistence path stores full agent prompt text even when session restoration is disabled, putting sensitive prompt contents outside the existing AI-history retention control.
Security
- Agent prompts can contain secrets, source snippets, credentials, or other sensitive user text. Persisting them independently of the session-restoration setting creates a local retention path users may reasonably expect to be disabled.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| history.append(prompt.clone(), start_ts); | ||
| }); | ||
| let prompt_sender = model_event_sender.clone(); | ||
| let insert_agent_prompt_event = ModelEvent::InsertAgentPrompt { prompt, start_ts }; |
There was a problem hiding this comment.
restore_session_enabled is false, so users who disabled session restoration still retain agent prompts locally. Gate InsertAgentPrompt on the same retention/privacy setting or add an explicit prompt-history opt-in before persisting.
There was a problem hiding this comment.
Any process to resolve data compliance called out by Oz?
nld history may not suit for only storing agent prompt with restore_session , but we might gate it with if is nld on?
Description
Created agent_prompt table, to track submitted prompt, with write cap as 2k (for read/fuzzy match latency concern), and apply NLD history match on both agent_prompt & cmd history, whichever match comes later.
Did not reuse ai_queries table, as it didn't have a write cap for its purpose and subjective to session restoration setting.
Linked Issue
ready-to-specorready-to-implement.Testing
./script/runScreenshots / Videos
https://www.loom.com/share/38649a38140d4ef18aac09216d87a575
We tested two queries, after deleting current sqlite DB tables and zsh history
Agent Mode