Skip to content

Add include_prompts_in_repositories whitelist for prompt storage#362

Merged
svarlamov merged 1 commit intogit-ai-project:mainfrom
jwiegley:feature/include-prompts-in-repositories
Feb 7, 2026
Merged

Add include_prompts_in_repositories whitelist for prompt storage#362
svarlamov merged 1 commit intogit-ai-project:mainfrom
jwiegley:feature/include-prompts-in-repositories

Conversation

@jwiegley
Copy link
Copy Markdown
Contributor

@jwiegley jwiegley commented Jan 16, 2026

Summary

  • Adds include_prompts_in_repositories config option to whitelist repositories for enterprise prompt storage (CAS)
  • Adds default_prompt_storage config option to specify fallback storage mode for non-whitelisted repos
  • Adds PromptStorageMode enum for type-safe handling of storage modes
  • Updates effective_prompt_storage() resolver to handle the new whitelist logic with proper precedence

Motivation

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: Added PromptStorageMode enum, new config fields, effective_prompt_storage() resolver, and tests
  • src/authorship/post_commit.rs: Updated to use new effective_prompt_storage() resolver
  • src/commands/config.rs: Added CLI support for get/set/unset of new config options

Test plan

  • Added unit tests for PromptStorageMode::from_str() and as_str()
  • Added unit tests for effective_prompt_storage() covering:
    • No include list uses global prompt_storage (legacy behavior)
    • Exclude list always wins (returns Local)
    • Wildcard include matches repos without remotes
    • Non-wildcard include with no match uses fallback
    • No fallback configured defaults to Local
    • Pattern matching works correctly
  • All existing tests pass

🤖 Generated with Claude Code


Open with Devin

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 16, 2026

CLA assistant check
All committers have signed the CLA.

@jwiegley jwiegley force-pushed the feature/include-prompts-in-repositories branch 3 times, most recently from e0beef9 to c9c889d Compare January 17, 2026 00:36
@jwiegley
Copy link
Copy Markdown
Contributor Author

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…

@acunniffe
Copy link
Copy Markdown
Collaborator

Seems to be working now. I've never see it do that before.

@jwiegley
Copy link
Copy Markdown
Contributor Author

image

@acunniffe acunniffe requested a review from svarlamov January 17, 2026 12:24
@svarlamov svarlamov assigned svarlamov and unassigned svarlamov Jan 17, 2026
@jwiegley jwiegley force-pushed the feature/include-prompts-in-repositories branch from c9c889d to 40d5af1 Compare January 28, 2026 18:45
@jwiegley jwiegley force-pushed the feature/include-prompts-in-repositories branch 2 times, most recently from 273e330 to 2642d9e Compare February 3, 2026 22:41
@jw-pos
Copy link
Copy Markdown

jw-pos commented Feb 3, 2026

All signed now, I just had the wrong authorship for the commit.

@jwiegley jwiegley force-pushed the feature/include-prompts-in-repositories branch from 2642d9e to 55ffadd Compare February 4, 2026 18:44
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>
@jwiegley jwiegley force-pushed the feature/include-prompts-in-repositories branch from 55ffadd to 3e68eff Compare February 4, 2026 20:08
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Open in Devin Review

@svarlamov svarlamov merged commit 3e68eff into git-ai-project:main Feb 7, 2026
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants