Feat/custom agents md instructions per repo or global - #142
Conversation
Greptile SummaryThe PR adds global and repository-scoped operator instructions that are persisted in SQLite, administered through protected API and dashboard controls, and prepended to agent contexts.
Confidence Score: 4/5The PR is not yet safe to merge because instruction-storage failures still let agent runs proceed without required operator constraints. The instruction resolver’s error branch returns the unmodified context, leaving the previously reported constraint-bypass behavior reachable whenever SQLite instruction lookup fails. Files Needing Attention: crates/claudear-engine/src/processing.rs Important Files Changed
Reviews (9): Last reviewed commit: "fix(dashboard): don't show Saved for unp..." | Re-trigger Greptile |
b38c248 to
862e212
Compare
| format!("{block}\n\n{context}") | ||
| } | ||
| } | ||
| _ => context, |
There was a problem hiding this comment.
Instruction lookup failures bypass constraints
When instruction resolution returns a storage error, this catch-all arm continues with the original context, causing the agent to run without configured operator constraints and without surfacing the failure.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/claudear-engine/src/processing.rs
Line: 2810
Comment:
**Instruction lookup failures bypass constraints**
When instruction resolution returns a storage error, this catch-all arm continues with the original context, causing the agent to run without configured operator constraints and without surfacing the failure.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.862e212 to
6ad97e3
Compare
Global and per-repo operator instruction storage. Register V10 and update migrator test to v10.
Scope-namespaced upsert and getters plus resolve_agent_instructions which concatenates global then per-repo. Wired through KnowledgeStore.
prepend_operator_instructions applied on the fix, red, verify and reply paths. Prompt-string only, never touches repo files.
Global instructions apply even with no resolved repo. Per-repo header only when a repo is present.
Drop the early return that skipped global instructions when the repo was unresolved, and inject on the QA answer path.
Disable editing on a failed load to avoid overwriting, and show save failures instead of silently swallowing them.
Separate the PUT from cache revalidation. On success, optimistically sync the cache with revalidate:false so a failed background GET no longer reports a failed save, keeps the draft dirty, or blanks the editor.
Warn on a storage error instead of silently continuing, so a failed instruction resolution is visible while still failing open.
Capture the saved value and only clear the draft when it is unchanged, so edits typed during the PUT are not discarded.
Gate the Saved indicator on !dirty so edits typed during the PUT surface as Unsaved changes instead of a false Saved.
5707415 to
b096ce0
Compare
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)