Add include_prompts_in_repositories whitelist for prompt storage#362
Conversation
e0beef9 to
c9c889d
Compare
|
Hmm… When I click on the signing link, it says that I have signed the agreement, but it is not showing up in the status here… |
|
Seems to be working now. I've never see it do that before. |
c9c889d to
40d5af1
Compare
273e330 to
2642d9e
Compare
|
All signed now, I just had the wrong authorship for the commit. |
2642d9e to
55ffadd
Compare
This feature enables users to configure which repositories should use
the enterprise prompt_storage (CAS) setting, with all other repositories
falling back to a configurable default mode.
Changes:
- Add PromptStorageMode enum with Default, Notes, Local variants
- Add include_prompts_in_repositories config option (glob patterns)
- Add default_prompt_storage fallback config option
- Add effective_prompt_storage() resolver function that:
- First checks exclusion list (deny always wins → Local)
- If no include list, uses legacy prompt_storage behavior
- If include list exists, checks if repo matches patterns
- Update post_commit.rs to use the new resolver
- Add CLI support for get/set/unset of new config options
- Add comprehensive tests for the new functionality
Example configuration for work repos only using CAS:
{
"prompt_storage": "default",
"include_prompts_in_repositories": ["https://github.com/myorg/*"],
"default_prompt_storage": "notes"
}
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55ffadd to
3e68eff
Compare
There was a problem hiding this comment.
Devin Review found 1 potential issue.
🐛 1 issue in files not directly in the diff
🐛 CAS flush not triggered when default_prompt_storage is 'default' but prompt_storage is not (src/commands/hooks/push_hooks.rs:60-63)
The CAS background flush is only spawned when the global prompt_storage() equals "default". However, with the new effective_prompt_storage() logic, CAS objects can be queued even when prompt_storage is "notes" or "local", if default_prompt_storage is set to "default".
Root Cause
The push_hooks.rs:61 checks prompt_storage() == "default" to decide whether to spawn the CAS flush:
if crate::config::Config::get().prompt_storage() == "default" {
crate::commands::flush_cas::spawn_background_cas_flush();
}But in post_commit.rs:93, the code uses effective_prompt_storage() which can return PromptStorageMode::Default even when the global prompt_storage() is not "default":
let effective_storage = Config::get().effective_prompt_storage(&Some(repo.clone()));For example, if a user configures:
prompt_storage = "notes"(primary mode for included repos)include_prompts_in_repositories = ["work-repo/*"]default_prompt_storage = "default"(fallback for non-included repos)
Then for repos NOT in the include list, effective_prompt_storage() returns Default, CAS objects get queued during post_commit, but the CAS flush is never triggered during push because prompt_storage() == "default" is false.
Impact: CAS objects will accumulate in the local database but never be uploaded to the server, causing data loss for prompt storage.
View 4 additional findings in Devin Review.

Summary
include_prompts_in_repositoriesconfig option to whitelist repositories for enterprise prompt storage (CAS)default_prompt_storageconfig option to specify fallback storage mode for non-whitelisted reposPromptStorageModeenum for type-safe handling of storage modeseffective_prompt_storage()resolver to handle the new whitelist logic with proper precedenceMotivation
This enables two common use cases:
User A (wants git-ai everywhere, CAS for work repos, notes for OSS):
{ "prompt_storage": "default", "include_prompts_in_repositories": ["https://github.com/myorg/*"], "default_prompt_storage": "notes" }User B (wants git-ai only for work repos with CAS):
{ "prompt_storage": "default", "allow_repositories": ["https://github.com/myorg/*"], "include_prompts_in_repositories": ["*"] }Changes
src/config.rs: AddedPromptStorageModeenum, new config fields,effective_prompt_storage()resolver, and testssrc/authorship/post_commit.rs: Updated to use neweffective_prompt_storage()resolversrc/commands/config.rs: Added CLI support for get/set/unset of new config optionsTest plan
PromptStorageMode::from_str()andas_str()effective_prompt_storage()covering:🤖 Generated with Claude Code