feat(sentinel): add provenance-aware memory and declarative skills - #26
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e70abaccd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, err := validateSentinelLearningEvidenceRefs(schema, item.Scope, item.EvidenceRefs, true); err != nil { | ||
| return item, err | ||
| } | ||
| if err := updateSentinelMemoryState(schema, memoryID, SentinelMemoryStateCandidate, SentinelMemoryStateValidated); err != nil { |
There was a problem hiding this comment.
Make validation atomic with counter-evidence updates
When validation and counter-evidence requests overlap, validation can read an empty counter-evidence list, the other request can append evidence while leaving the row CANDIDATE, and this unconditional state transition can then mark that contradicted row VALIDATED. Because validated rows are immediately included in model context, perform the counter-evidence check and state change atomically, such as with a conditional update or row lock.
Useful? React with 👍 / 👎.
| AND NOT EXISTS ( | ||
| SELECT 1 FROM %s.sentinel_skills s | ||
| WHERE s.source_case_id = c.id | ||
| AND s.state IN ('DRAFT','VALIDATED','SHADOW','TRUSTED') |
There was a problem hiding this comment.
Preserve cases referenced by active skill evaluations
When a resolved replay Case crosses the retention cutoff while its skill is still VALIDATED or SHADOW, this guard preserves only the skill's source Case. Deleting any other replay Case cascades through sentinel_skill_evaluations, reducing the distinct replay count; a shadow skill can consequently become impossible to promote after its historical Cases have already been removed. Active evaluation Cases need the same retention protection as source Cases.
Useful? React with 👍 / 👎.
| for _, candidate := range match.Sources { | ||
| if strings.EqualFold(candidate, source) { |
There was a problem hiding this comment.
Match skills against normalized selectors
For a draft containing a selector such as " log_anomaly ", validation accepts it after trimming and lowercasing, but ValidateSentinelSkillSpec receives the spec by value and never persists that normalized selector. This comparison therefore uses the original whitespace-bearing value, so the validated skill never matches during replay, shadow evaluation, or trusted execution; normalize again here or store the normalized spec.
Useful? React with 👍 / 👎.
Implements #21 as a stacked PR on top of #25 (
sentinel-model-routing).What changes
sentinel_casesledger and adds a separate learned-memory store with scope, confidence, evidence provenance, counter-evidence, validation state, TTL, supersession and expiry;DRAFT -> VALIDATED -> SHADOW -> TRUSTED -> DEPRECATED/REVOKED;VALIDATEDnon-expired learned memories andTRUSTEDskills to the Context Compiler aslearned_knowledge;CANDIDATEs and skillDRAFTs after strict JSON/evidence validation;SENTINEL_AUTO_CURATION=falseopt-in configuration.Security invariants
TRUSTEDskills can only select already-registered read-only tools; the controller reconstructs arguments from Case scope;as_oftimestamp;Validation
The final cleaned head is
0e70abaccd696dac247a0f53f436ca56848fc51c.Because the repository CI is configured to run only for PRs targeting
main, this PR was temporarily retargeted tomain, reopened, and validated without changing the head. CI #125 / run34082094945completed successfully, then the PR was returned to its stacked base.Full green suite:
go vet ./...;go test -race;govulncheck;The final cross-Case provenance retention hardening also independently passed
gofmt,go vet ./..., andgo test ./...before the temporary patch infrastructure was removed.Closes #21.