Feat/custom agents md instructions per repo or global - #142
Feat/custom agents md instructions per repo or global#142ArnabChatterjee20k wants to merge 17 commits into
Conversation
Greptile SummaryThe PR adds global and repository-scoped operator instructions, persists them in SQLite, injects them into agent contexts, and exposes administrative editors.
Confidence Score: 4/5The PR is not yet safe to merge because instruction lookup failures still let agent runs proceed without required operator constraints. The instruction helper catches storage failures and returns the unmodified context, so any affected run continues without the configured global or repository behavior. Files Needing Attention: crates/claudear-engine/src/processing.rs Important Files Changed
Reviews (8): 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.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.
862e212 to
6ad97e3
Compare
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.
| setSaved(true) | ||
| setTimeout(() => setSaved(false), 3000) |
There was a problem hiding this comment.
Newer draft falsely marked saved
When an administrator continues typing while the PUT is in flight, save completion preserves the newer draft but unconditionally sets saved to true. The editor consequently displays “Saved” and suppresses “Unsaved changes” for text that was never persisted; the repository editor repeats the same transition.
Prompt To Fix With AI
This is a comment left during a code review.
Path: dashboard/src/pages/config.tsx
Line: 403-404
Comment:
**Newer draft falsely marked saved**
When an administrator continues typing while the PUT is in flight, save completion preserves the newer draft but unconditionally sets `saved` to true. The editor consequently displays “Saved” and suppresses “Unsaved changes” for text that was never persisted; the repository editor repeats the same transition.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Gate the Saved indicator on !dirty so edits typed during the PUT surface as Unsaved changes instead of a false Saved.
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.)