Route Patrol approval handoffs through structured context

This commit is contained in:
rcourtman
2026-05-07 14:35:07 +01:00
parent 92ee9c3b1e
commit dd2ee25867
5 changed files with 211 additions and 132 deletions
@@ -309,7 +309,13 @@ runtime cost control, and shared AI transport surfaces.
while preserving the safe visible briefing and request-local
approval-required posture; later turns must rely on backend-owned session
model-context hydration and current canonical stores instead of resending
stale browser handoff payloads.
stale browser handoff payloads. Patrol approval-row Assistant entries are
still Patrol finding handoffs, not local prompt-only shortcuts: live
approval rows, expired proposed-fix rows, and missing-detail queued-fix
recovery rows must route through the shared Patrol finding handoff builder
so the backend receives the same bounded model-only finding context,
resource reference, and safe action reference posture that the main finding
handoff uses.
Proposed-fix command text must stay out of both the persisted chat message
and the model-only handoff context, and command payloads remain
approval-context data, not conversational copy.
@@ -877,18 +877,20 @@ frontend primitive boundary.
structured finding context, so
Patrol handoffs render as Patrol handoffs or Patrol findings, and alert
handoffs render as alert investigations, rather than generic dashboard
briefs. Patrol approval-row Assistant prompts must
follow that same drawer primitive contract: safe approval metadata may enter
the prompt and context, but raw command text stays out and the scoped
request must pass `autonomousMode:false` instead of changing the user's
persistent Assistant control level. Patrol remediation-plan drawer handoffs
must use the same primitive boundary: plan title/status/risk, step labels,
and command counts may enter Assistant context; raw command and rollback
command payloads must stay in the governed remediation/action panel. Finding
discussion handoffs that reference a live approval, proposed fix, fix
outcome, or remediation plan must also pass `autonomousMode:false` as a
request-local override so the drawer shows approval-required posture without
mutating the persistent Assistant control setting.
briefs. Patrol approval-row Assistant prompts must route through the same
feature-owned finding handoff helper rather than hand-written prompt-only
drawer opens: safe approval metadata, proposed-fix summaries, resource
references, and bounded `handoff_actions` may enter the prompt and context,
but raw command text stays out and the scoped request must pass
`autonomousMode:false` instead of changing the user's persistent Assistant
control level. Patrol remediation-plan drawer handoffs must use the same
primitive boundary: plan title/status/risk, step labels, and command counts
may enter Assistant context; raw command and rollback command payloads must
stay in the governed remediation/action panel. Finding discussion handoffs
that reference a live approval, proposed fix, fix outcome, or remediation
plan must also pass `autonomousMode:false` as a request-local override so
the drawer shows approval-required posture without mutating the persistent
Assistant control setting.
11. Keep shared filter primitives coherent with route-owned option hydration.
Feature shells such as `frontend-modern/src/features/infrastructure/`
must keep a route-owned canonical option visible in shared selects like
@@ -171,13 +171,16 @@ Patrol-specific presentation helpers.
sync. The model-only context may include current finding status, recurrence,
investigation record facts, evidence, verification, approval posture,
dry-run posture, proposed-fix summary, and target resource references without
raw command payloads. Inline
Patrol approval actions that open Assistant must follow the
same rule: pass approval ID/status/risk/target plus safe summary/count
metadata as review context, force the request-local approval-required mode,
attach the Patrol-owned visible drawer briefing for the pending approval, and
never paste the approval command or proposed-fix command text into the chat
prompt. Remediation-plan Assistant
raw command payloads. Inline Patrol approval actions in
`frontend-modern/src/components/patrol/ApprovalSection.tsx` that open
Assistant must follow that same Patrol-owned handoff model rather than a
prompt-only local shortcut: pass approval ID/status/risk/target plus safe
summary/count metadata as review context, attach the target resource
reference, include bounded `handoff_actions` for live approvals or structured
proposed fixes when present, force the request-local approval-required mode,
attach the Patrol-owned visible drawer briefing for the pending approval or
queued-fix recovery state, and never paste the approval command or
proposed-fix command text into the chat prompt. Remediation-plan Assistant
handoffs follow the same boundary: step labels, plan status, risk, and command
counts are allowed, safe suggested prompts may ask about plan risk,
prerequisites, rollback, and verification, while command and rollback command