Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

feat(kora): KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET — 5 new card variants + alert investigations viewer#198

Merged
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET
May 24, 2026
Merged

feat(kora): KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET — 5 new card variants + alert investigations viewer#198
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET

Conversation

@rafe-walker

Copy link
Copy Markdown
Owner

Summary

Two deliverables that close the FE side of the promotion-loops product direction + add the cockpit surface for alert investigations.

Drift-guard pin summary (3 new)

Pin Test Asserts
_PROMOTION_LOOP_TYPES (BE) ↔ PROMOTION_LOOP_NAMES (FE) test_promotion_loop_types_drift_guard Same 6 loop names in the same order — tab navigation can't silently re-order
PROMOTION_LOOP_SLUGS (FE map) ↔ BE endpoint paths test_promotion_loop_slugs_match_loop_dirs Every slug in the FE URL map corresponds to a real /api/promotions/<slug>/pending endpoint
_ALERT_DM_STATUS_VALUES alias to _DM_STATUS_VALUES test_alert_dm_status_drift_guard Alert + probe wakes share the same DM-dispatch enum — alias is the rename target if they ever diverge

Plus:

Per-card visual summary

Card variants (all in PromotionReviewPage.tsx):

Variant Treatment Approve flow
PhrasebookCard Yellow border (pending), SnapshotPreview band edit-before-approve OR direct approve
RouterTuningCard Yellow border, tighten/loosen chip, rate/cost stats approve OR reject (no edit — operator scaffolds prompt)
ToolTrimmingCard Yellow border, collapsible unused-tools list approve OR reject
ProbeEnvelopeCard RED border + HIGH RISK badge + blast-radius strip + manual-scaffold disclaimer approve (renamed "Approve (manual scaffold required)") OR reject
SnapshotExpandCard Green border when auto-applied / yellow AUTO-APPLY warning strip when env on read-only (no approve/reject — loop self-applies)
EmailIntentCard Same chrome as PhrasebookCard approve/reject — forward-compat; tab shows "no proposals yet" empty state until NousResearch#420

STOP-ASKs resolved inline

  1. Loop discriminator (§4 bullet 1) — BE already echoes loop_name in the 3 newer loop responses; phrasebook didn't. Added loop_name: "phrasebook" to the phrasebook response (1-line BE change) so FE has a uniform discriminator across all 6 loops. No new field on the proposal payloads themselves — discriminator lives at the response envelope.
  2. "All" tab aggregate (§4 bullet 2) — built /api/promotions/counts aggregate endpoint (one round-trip) instead of fanning out to 6 /pending reads. Pre-aggregation per-loop (list_pending / list_by_status) is fast enough; pagination not needed at today's volume.
  3. AlertInvestigationsPage endpoint missing (§4 bullet 3) — built /api/alert-investigations cleanly as forward-compat. Added alert.wake_requested + alert.investigation_completed to SeamName Literal so read_audit_entries returns [] instead of ValidationError until fix: respect OPENAI_BASE_URL when resolving API key priority NousResearch/hermes-agent#420 starts emitting. Page renders empty-state UX in the interim.
  4. HIGH-RISK visual treatment for ProbeEnvelopeCard (§4 bullet 4) — defaults: red border (border-destructive/60), "HIGH RISK" destructive badge, dedicated red-background blast-radius strip, yellow warning strip with "Approve does NOT mutate fix_envelopes.py", renamed approve button to "Approve (manual scaffold required)". Pinned by test_high_risk_probe_envelope_visual_treatment. No explicit confirmation step in v1 — operator already has approve-with-notes affordance.

Screenshots

All 3 in web/docs/promotion-review-multi-loop-extend-megabucket/:

  • promotion_review_multi_loop.png — Router tab active, showing RouterTuningCard + ToolTrimmingCard + HIGH-RISK ProbeEnvelopeCard + SnapshotExpandCard with AUTO-APPLY warning
  • promotion_review_phrasebook_email.png — PhrasebookCard with SnapshotPreview preserved + Email tab empty state + sample EmailIntentCard shape (forward-compat preview)
  • alert_investigations.png — empty state today (pre-fix: respect OPENAI_BASE_URL when resolving API key priority NousResearch/hermes-agent#420) above + populated layout preview (cost_anomaly critical with auto-action + vercel_deploy_failure warning)

Test plan

  • tsc -b clean
  • vite build clean (1.9 MB bundle; no new warnings)
  • 117 new + retained tests pass (drift-guards + endpoint behaviour + FE pins)
  • Full tests/kora_cli/ regression: 0 new failures introduced; pre-existing PTY / cron_profiles / panel_view inventory / model_switch failures confirmed identical on base via stash
  • Operator smoke: open /promotions/phrasebook, switch tabs across all 6 loops, verify counts populate from /api/promotions/counts
  • Operator smoke: open Envelopes tab, confirm HIGH-RISK card chrome (red border + manual-scaffold disclaimer)
  • Operator smoke: enable KORA_PROMOTE_SNAPSHOT_EXPAND_AUTO_APPLY=true, verify Snapshot tab shows AUTO-APPLY warning strip
  • Operator smoke: open /alert-investigations, confirm empty state copy (pre-fix: respect OPENAI_BASE_URL when resolving API key priority NousResearch/hermes-agent#420)

Recommended next CC#2 dispatch

Two candidates surfaced during this batch:

  1. KR-FE-COCKPIT-NAV-RESTRUCTURE — sidebar is past 25 nav entries with the Alert Investigations + Logged-Only additions; an operator group/collapse pass would help triage. Doable as a focused single-deliverable bucket.
  2. Hook KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND post-fix: respect OPENAI_BASE_URL when resolving API key priority NousResearch/hermes-agent#420 — when CC#1's fix: respect OPENAI_BASE_URL when resolving API key priority NousResearch/hermes-agent#420 lands, verify the EmailIntentCard renders correctly against real payloads + the AlertInvestigationsPage populates. Likely a small follow-on bucket (mostly verification + tightening any type assumptions).

🤖 Generated with Claude Code

…ew card variants + alert investigations viewer

Two deliverables that close the FE side of the promotion-loops
product direction + add the cockpit surface for alert investigations.

A) KR-FE-PROMOTION-REVIEW-PANEL-EXTEND
   * PromotionReviewPage extended from phrasebook-only to host 6
     loop variants via LoopTypeTabs (Phrasebook / Router / Tools /
     Envelopes / Snapshot / Email).
   * Per-loop card variants render distinct payload shapes:
     - PhrasebookCard: edit-before-approve + SnapshotPreview (preserved)
     - RouterTuningCard: route + escalation_rate + tighten/loosen
       recommendation chip
     - ToolTrimmingCard: route + collapsible unused-tools list
     - ProbeEnvelopeCard: HIGH-RISK red border + manual-scaffold
       disclaimer + blast-radius summary
     - SnapshotExpandCard: informational (audit-derived) with
       AUTO-APPLY env-flag warning when on
     - EmailIntentCard: forward-compat for CC#1's NousResearch#420 — renders
       cleanly empty until the BE loop ships
   * New BE endpoint GET /api/promotions/counts aggregates per-loop
     pending counts in one round-trip; sidebar PendingBadge now
     reflects all actionable loops (excludes snapshot_expand).
   * New BE endpoint GET /api/promotions/snapshot-expand/recent
     reads promotion.snapshot_field_added audit rows for the
     read-only Snapshot card variant.
   * Phrasebook /pending response gains loop_name field for
     symmetric FE discrimination.
   * Drift-guard: _PROMOTION_LOOP_TYPES (BE) ↔ PROMOTION_LOOP_NAMES
     (FE) pinned by test_promotion_loop_types_drift_guard.

B) KR-FE-ALERT-INVESTIGATIONS-VIEWER (forward-compat for NousResearch#420)
   * New BE endpoint GET /api/alert-investigations mirrors
     /api/probe-investigations: joins alert.wake_requested +
     alert.investigation_completed audit rows + slack_dm_log entries
     by caller_session_id ``alert:{category}:{severity}``.
   * Both alert seams added to SeamName Literal as forward-compat
     so read_audit_entries doesn't ValidationError once NousResearch#420
     starts emitting.
   * _ALERT_DM_STATUS_VALUES alias to _DM_STATUS_VALUES — alert +
     probe wakes share the same DM-dispatch path.
   * New FE page /alert-investigations with empty-state framing for
     the forward-compat case + populated layout (with autoaction
     badge, dm_status filter chips, severity summary, drill links).
   * KoraActionsPage extended with alert_investigation_completed
     category — deep-links to /alert-investigations once seam fires.
   * Drill-down allowlist extended with alert.wake_requested +
     alert.investigation_completed.

Tests: 117 new + retained tests pass. Full kora_cli regression
introduces zero new failures (pre-existing PTY / cron_profiles /
panel_view inventory / model_switch failures confirmed identical
on base branch via stash).

Screenshots: web/docs/promotion-review-multi-loop-extend-megabucket/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafe-walker rafe-walker force-pushed the feat/kora-KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET branch from 16f36b9 to 4818d52 Compare May 24, 2026 08:41
@rafe-walker rafe-walker merged commit 53d9831 into feature/phase2-upgrades May 24, 2026
2 of 4 checks passed
@rafe-walker rafe-walker deleted the feat/kora-KR-FE-PROMOTION-REVIEW-MULTI-LOOP-EXTEND-MEGABUCKET branch May 24, 2026 08:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant