Skip to content

feat: record which actor decided an intercept approval - #165

Merged
BaaRai merged 3 commits into
mainfrom
feat/intercept-decided-by
Nov 9, 2026
Merged

BaaRai merged 3 commits into
mainfrom
feat/intercept-decided-by

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

What

Records which actor settled an intercept approval (human, rule, model, system) and shows it in the approval records. Approval semantics do not change.

  • Writers: rule and model rows (CreateDecidedIntercept), human allow/deny (Decide), timeouts and work-cancelled denials (system). Pending rows keep ''.
  • ResolveIntercept takes the actor explicitly and rejects any other value before the database is touched.
  • The list and detail return decided_by exactly as stored. The decided_by filter matches that same value, so what a row displays is what the filter finds.
  • Legacy rows (decided_by = '') show "Legacy", match no decided_by filter, and keep their decision_source in its own column. Nothing is rewritten.
  • UI: a "Decided by" column and a filter beside "Decision source", with "AI-approved only" = model.

Decisions to review

  • "AI-approved only" filters decided_by = model only. It includes model-judged denials, unlike a status filter. Renaming it is a one-line change.
  • db/task_archives_restore.go: archives without the column get '', and a restored pending row becomes system.
  • DecideInterceptPending has no callers and does not write decided_by; left as found.
  • Mock data and the optimistic update after a decision also carry decided_by.

Verification

  • go build ./..., go vet on db, server, intercept: pass.
  • Go tests against a throwaway Postgres 16 container (removed afterwards): db, intercept, server pass.
  • gofmt: clean on the CR-stripped content.
  • tsc --noEmit: pass. biome lint and biome check report the same diagnostics as origin/main: no new findings.
  • The UI was checked in mock mode only, not against the real backend. Not checked: dark theme, widths under 768 px, a real database with legacy rows.

Do not merge before go, shell and web are green on the exact head SHA.

Add intercept_pending.decided_by (human | rule | model | system; empty while
pending or for rows decided before the column existed). Approval semantics are
unchanged: only the actor is recorded.

- rule-matched and model-judged rows written by CreateDecidedIntercept record
  rule or model;
- ResolveIntercept takes the actor explicitly and rejects any other value
  before touching the database;
- Decide (human allow/deny) records human; timeouts and work-cancelled
  denials record system. Work-cancelled is a system refusal, not a human one.
- decided_by is exposed on the pending and approval records and filterable
  with decided_by=human|rule|model|system (anything else is a 400).
- Legacy rows show decision_source as their actor when decided_by is empty.
  The filter uses the stored column only, so decided_by=model cannot match
  older human decisions or timeouts.
- Archive restore fills decided_by for archives that predate the column, and
  marks a restored pending row as system.
The approval list and detail return decided_by exactly as stored, and the
decided_by filter matches that same value. Rows decided before the column
existed show "Legacy" and match no decided_by filter; their decision_source
stays in its own column and nothing is rewritten.

UI: a "Decided by" column (Human, Rule, Model, System) and a matching filter
beside the decision-source filter, including "AI-approved only" for model.
Types and the API query carry decided_by the same way decision_source does.
The option filters decided_by = model, which includes denials the model judge
made, so "AI-approved" was inaccurate. Approved-by-AI is the combination with
status allowed.
@BaaRai
BaaRai merged commit a83f494 into main Nov 9, 2026
3 checks passed
@BaaRai BaaRai mentioned this pull request Nov 11, 2026
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.

1 participant