feat(remediation): the scheduling service reports effort states #400
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.47) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 499 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.372
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #400"
general
weight: 0.35
chubirka
What
The remediation domain's state-report surface, in the scheduling service — the reads the
engine's trigger plans off. Shaun's design direction (2026-11-08, traust-foundry#11 wave
(g), commit 9c14af7):
engine#146/#147 landed that anti-pattern knowingly (the trigger needed the reads); this
PR is core's half of the extraction — the engine's half deletes its re-statement and
consumes this surface directly (stacked on this branch's pin).
RemediationState(besideScheduledEffort,models/remediation_scheduling.py):the slim projection a planner needs — the work-item handle (the assessment, so feed
events name it directly, contracts#117), the repository, the folded status, and the
lineage's over attempts as
reattempts. A consumer needing fork facts or the workitem's detail reads the effort itself.
RemediationSchedulingService.state_of/states_of: the keyed read and therepository listing, over the fold the service already reads (
_efforts→work_item_orders→ the work items). The lineage semantics moved from the engine'sCLI adapter verbatim: one report per finding-set lineage, its head reporting with the
lineage's over attempts as
reattempts(an over attempt is retried as a NEW work itemover the same findings); an over attempt a newer one over the same findings supersedes
is not reported; a still-vulnerable effort a newer one supersedes reads as no effort,
so a replayed feed event cannot bypass the reattempt limit.
remediation:/verify-remediation:prefixes,with
is_remediation_rule) besideREMEDIATE_FINDINGinmodels/operations.py—where core names the door's order vocabulary today; the rules ride the same orders.
This resolves the two standing escalations from engine#146/#147's reviews in one move:
1. The reattempts derivation — "core's to offer": the derivation now lives here,
over the orders and work items the service already reads, instead of the engine's
adapter folding lineages client-side (where
reattemptsread 0 from the keyed getand the limit never bound).
2. The by-assessment read's shape — "core's read decides": the keyed read misses
softly (
None), so a feed-driven consumer replaying events that name unscheduledassessments suppresses no 404 of its own.
The keyed read stays on
getexcept for the one status a reattempt limit gates on: astill-vulnerable effort resolves through its repository's lineages so its priors and any
superseding effort are read with it; every other status carries no count the limit asks
for.
Changed tests
New service tests over SQLite (+ the Postgres integration backend where available):
the keyed read's mapping and soft miss, the lineage fold (head with priors, superseded
prior unreported, overlapping-but-different findings as another lineage, a live effort
never displaced), the superseded still-vulnerable effort reading as no effort with the
retry reporting its priors, and the repository isolation. The engine's adapter tests
(engine#147's
FakeScheduling/_CoreRemediationssuite) move here as these — over thereal doors instead of fakes.
make lint-fix && make test: green — 11661 passed. (Threetests/v1/context/test_services.pytests fail on this workstation's defaultHOMEfrom a stale local
~/.traust/traust.dbpredating the fork columns; they failidentically on untouched
developmentand pass with a cleanHOME, so they areenvironmental, not this change.)
stacked-PR: the engine half pins this branch's head and deletes its re-statement
💘 Generated with Crush
Assisted-by: Crush:rits/zai-org/glm-5-3