Skip to content

AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).

Fix handled-rail collapse, status vocabulary, and quiet-only rendering

Claudeb43d7b4aa904
diff --git a/packages/core/openexecutive/api/routes/today.py b/packages/core/openexecutive/api/routes/today.py
index ddf55451..d9eacc3a 100644
--- a/packages/core/openexecutive/api/routes/today.py
+++ b/packages/core/openexecutive/api/routes/today.py
@@ -163,11 +163,19 @@ def _as_int(raw: Any) -> int | None:
return None
-def _alert_status_now(alert_id: int | None) -> str:
- """Current lifecycle state of the alert a handled row touched."""
+def _alert_status_now(alert_id: int | None, now: datetime) -> str:
+ """Current lifecycle state of the alert a handled row touched.
+
+ ``open`` means exactly "in the /today queue right now" (`lifecycle.is_live`:
+ unread, inside its TTL, not snoozed) — the only state where a "still open"
+ jump link has a card to land on and where a close row can be read as
+ undone. ``acked`` is the principal's own approval (not an Undo target),
+ ``inactive`` a snoozed / TTL-expired row the sweep has not closed yet.
+ """
if alert_id is None:
return ""
try:
+ from openexecutive.alerts import lifecycle
from openexecutive.alerts.store import get_alert
alert = get_alert(alert_id)
@@ -180,7 +188,9 @@ def _alert_status_now(alert_id: int | None) -> str:
return "merged"
if alert.status in {"resolved", "dismissed", "expired"}:
return alert.status
- return "open"
+ if alert.status == "ack":
+ return "acked"
+ return "open" if lifecycle.is_live(alert, now) else "inactive"
# Which audit-details keys fill a handled row's `target` and `detail`, per
@@ -211,7 +221,7 @@ def _handled_outcome(kind: str, details: dict[str, Any]) -> str:
return ""
-def _handled_item(h: dict[str, Any]) -> HandledItem:
+def _handled_item(h: dict[str, Any], now: datetime) -> HandledItem:
"""One structured rail row from a `brief_state.handled_since` entry."""
kind = str(h["kind"])
raw_details = h.get("details")
@@ -235,7 +245,7 @@ def _handled_item(h: dict[str, Any]) -> HandledItem:
outcome=_handled_outcome(kind, details),
evidence_ref=str(details.get("evidence_ref") or ""),
superseded_by_alert_id=_as_int(details.get("superseded_by_alert_id")),
- status=_alert_status_now(alert_id),
+ status=_alert_status_now(alert_id, now),
)
@@ -245,7 +255,7 @@ def _handled_overnight(now: datetime) -> list[HandledItem]:
from openexecutive.briefing import brief_state
since = brief_state.since_for("principal_brief_morning", now=now)
- return [_handled_item(h) for h in brief_state.handled_since(since, limit=20)]
+ return [_handled_item(h, now) for h in brief_state.handled_since(since, limit=20)]
except Exception:
logger.debug("today: handled_overnight unavailable", exc_info=True)
return []
@@ -363,10 +373,12 @@ class HandledItem(BaseModel):
evidence_ref: str = ""
# The survivor a merge folded this alert into, for collapsing the pair.
superseded_by_alert_id: int | None = None
- # The alert's status NOW ("open" | "resolved" | "dismissed" | "expired" |
- # "merged"), "" when there is no alert. The rail is rebuilt from the audit
- # log on every fetch, so this is what tells the UI a close was already
- # undone (offer "Reopened", not another Undo).
+ # The alert's status NOW: "open" (live in the /today queue) | "resolved" |
+ # "dismissed" | "expired" | "merged" | "acked" (principal approved it) |
+ # "inactive" (snoozed / past TTL, unswept); "" when there is no alert. The
+ # rail is rebuilt from the audit log on every fetch, so this is what tells
+ # the UI a close was already undone (offer "Reopened", not another Undo)
+ # and whether a "still open" link has a card to land on.
status: str = ""
diff --git a/packages/core/openexecutive/architecture/prebuilt/today.json b/packages/core/openexecutive/architecture/prebuilt/today.json
index 04ffe7a1..c35a50e3 100644
--- a/packages/core/openexecutive/architecture/prebuilt/today.json
+++ b/packages/core/openexecutive/architecture/prebuilt/today.json
@@ -1,7 +1,7 @@
{
"section_id": "today",
"title": "Today / Morning Brief",
- "markdown": "`openexecutive.api.routes.today` serves the morning brief — a one-screen, read-only view of what is happening across the org. It is the default landing surface (the Next.js root renders `<Briefing>`).\n\n`GET /today` returns `TodayResponse` assembled by `_build_today()`, which is synchronous and caller-agnostic:\n\n- **`departments`** — per-department goal health, rolling up each department's goal counts (`total`, `at_risk`, `off_track`) plus its awaiting-workflow count, and `attention_goals`: the actual off-track/at-risk goals (worst first, capped at 3) with `key_result`, `current`, `target`, and `status`, so the briefing's Department card shows *which* goal is off and how far without a click. Empty for healthy/inactive departments.\n- **`people`** — an attention-ranked roster. Each person carries `awaiting_action` count, soonest SLA, a `status` (`on_leave` / `needs_reply` / `awaiting` / `clear`), reachability, `overdue`, a server `priority` sort key, and a cached one-line `insight`. Sorted by `(-priority, full_name)`.\n- **`proposals`** — the *live* unread alerts (workflow approvals, triage-classified inbound, Executive signals, flagged artifacts, and gated calendar bookings): unread, inside their category TTL, not snoozed — see *Alert lifecycle* below. Each carries `score`, `category` (`action` vs `monitoring`), `surfaced_reason` from `openexecutive.briefing.ranking`, the lifecycle fields (`occurrence_count`, `last_seen_at`, `last_reviewed_at`, `review_verdict`, `review_note`, `recommended_move`, `why_now`, `due_at`, `superseded_count`, `suggested_workflow`), and `decision_instance_id` (set only when the proposal is backed by a decision-ledger row — a calendar booking awaiting approval). The UI splits them into 'mine' vs 'across the team' using `caller_person_id`. For decision-backed proposals the card's Approve/Reject call the `/decisions` endpoints (which book or cancel the event server-side and clear the alert) instead of the ack-and-hand-off-to-chat flow — so meeting bookings are reviewed in the briefing itself rather than on a separate page.\n- **`narrative`** — a per-viewer Executive-voice header synthesized by `synthesize_briefing_narrative`; the principal gets the whole-company scope, teammates a role-scoped one. In the web UI each bullet of this narrative is a click target: clicking one hands off to chat (the same `onContinue` path as the proposal cards) seeded to discuss that item. The Executive recognizes it because every chat turn now carries a `<briefing>` digest of open alerts (see Memory).\n- **`in_flight`** / **`awaiting`** — upcoming Executive commitments and people we are waiting on.\n- **`handled_overnight`** — the autonomous moves the Executive *completed* since the last delivered morning brief: the alert review's (routed, nudged, escalated, drafted, merged, closed) plus the research watch policy's (`watching` — a watch added on its own because it was grounded in company data; `stopped_watching` — a research watch auto-disabled as noisy or dead; no alert id, re-enable from `/watchlist`). A `changed` verdict (the review rewrote an open alert's headline / body / severity) is deliberately **not** here: the alert is still open in \"Needs you\" and its card carries the note, so the brief reports it under \"what changed\" (a REWRITTEN block) rather than as done. Each row is structured, not just a sentence: `kind`, the audit `summary` (nudge bookkeeping marker stripped), `at`, `alert_id`, `event_type` (for a pre-filtered `/audit` deep link), `headline` (the alert's headline at move time; a watch's slug), `target` (person name for routed / nudged, survivor headline for merged, new severity for escalated, draft title, workflow name), `detail` (the cited evidence or the watch policy's reason), `outcome` (`resolved` | `dismissed` for a close, `proposed` for a route that went through the authority gate), `evidence_ref` (S1 / R2 / A3), `superseded_by_alert_id`, and `status` — the alert's lifecycle state **now** (`open` | `resolved` | `dismissed` | `expired` | `merged`), looked up per row so a close the principal already undid renders as reopened instead of offering a second Undo. The morning brief also carries a one-line count of research watch suggestions waiting on `/watchlist`.\n- **`talent`** — the active executive-search pipeline, rolled up by `briefing.talent_digest.build_talent_brief_items`: one item per non-terminal engagement (FILLED/CANCELLED dropped) with role, department, status, candidate count, per-stage counts, and four attention signals — `offers_expiring_soon` (extended offers within 72h of `expires_at`, or past it with no decision recorded — computed straight from the offers table so a missed nudge can't make the briefing stale), `needs_screening` (leads), `offers_out` (offers), and `stalled_count` (active candidates not touched in ≥7 days). Items sort expiring → offers → stalled → leads → size. It renders as the briefing's **Executive search** card (one per search; click-to-discuss hands off to chat via the same `onContinue` path), feeds the narrative (an offer landing or a search going cold re-writes the header — the narrative cache hash folds a talent fingerprint), and the same digest's `format_talent_for_prompt` is appended to the chat `<briefing>` block so the Executive can discuss live searches by client or role. One rollup, shared by all four surfaces, so the card / header / chat never disagree. See the Talent section.\n\nThe route resolves the caller from `x-caller-email`, then attaches the viewer-scoped narrative in a `BackgroundTask` so the request never blocks on an LLM call. `GET /today/activity` returns the recent self-initiated action rail — merged from fired scheduled actions (DMs, follow-ups, nudges, cadences), logged decisions, saved advice, completed workflow runs (briefings/check-ins/research), kicked-off initiatives, resolved gated decisions, and raised alerts, so it reflects all of the Executive's activity rather than just dispatched messages. The Pulse page (`/memories`) polls it (limit 100) every ~20s so new events stream into the 'Recent activity' card, which scrolls internally at a fixed height instead of growing the page. The `morning_brief` workflow calls `_build_today()` directly to build the standalone DM (via a different, enumerated prompt). `GET /morning-brief` is a deprecated alias.\n\n## Alert lifecycle & the Executive review\n\nAlerts used to be write-once: raised, then never looked at again, so the \"Needs you\" queue grew without bound and the briefs re-listed it daily. Three things now keep it live:\n\n- **Time-to-live** (`openexecutive.alerts.lifecycle`). Action items expire after `ALERT_TTL_DAYS_ACTION` (14 d), unrouted low/medium monitoring signals after `ALERT_TTL_DAYS_MONITORING` (3 d). Every surface reads `list_live_alerts` (the same predicate the scheduler's 15-minute sweep persists as status `expired`), so `/today` is right even before the sweep runs. Artifacts and decision-backed alerts are exempt. `POST /alerts/{id}/reopen` is the Undo.\n- **Coalescing** (`alerts.pipeline` + `store.coalesce_alert`). A repeat of an open alert with the same `(source, dedup_key)` updates that row — `occurrence_count`, `last_seen_at`, severity max — instead of stacking a second card, and only re-pings when severity rose to high/urgent. Monitoring alerts carry a stable `watch:<slug>` key, so one watch means one card.\n- **The review** (`openexecutive.alerts.review`, heartbeat `alert_review_scan`, every 6 h and right before the morning brief). For each open alert the Executive sees what changed since it was raised — newer signals from the same watch, related alerts, activity since, the roster with SLAs, department authority — and returns a verdict (relevant / changed / resolved / stale) plus a recommended move. Deterministic policy then acts: **route** (assign + DM the owner; `propose_via_alert` for propose-only departments), **nudge**, **escalate** (severity + `due_at` + DM the principal only), **draft** (`draft_artifact`), **suggest a workflow** (a link, never a run), **merge** (`superseded_by_alert_id`), or **resolve** — only on high confidence citing a server-minted evidence ref (a newer signal, a related alert, an activity item shown for that alert); free text never closes a card, and anything weaker is annotated `likely_stale`, demoted 30 ranking points, and left for one click. Everything that came from outside is rendered as inert data inside the review prompt, so an injected email body cannot steer the batch. Board / comp / legal matters only ever go to a scope-holder or the principal and keep their text. Route and escalate are idempotent across passes, every DM carries an \"[Alert review] Re: …\" header, outbound moves are capped per pass, passes are single-flight, `ALERT_REVIEW_ENABLED=false` stops every caller, every move is audited with its evidence and prior state, and a distinct `resolved` status keeps Executive closes separate from `ack` (user approved).\n\nOn the page, cards read as decisions: the one-line \"what changed since you last looked\" (`review_note`) leads, the recommended move is the primary control (Nudge <owner> → chat; Run <workflow> → `/jobs/<name>`), with chips for age, seen ×N, why-now / due, folded-in and draft-ready, a \"Reviewed <ago>\" footer, and an amber Likely-stale treatment with one-click Dismiss. \"Needs you\" shows *Start here* + 8 cards + \"Show N more\", a \"Dismiss N older than 7 days\" footer (explicit ids to `POST /alerts/bulk-ack` — never a server-side age sweep, which would hit teammates' routed items), and \"Re-check relevance\" (`POST /alerts/review`). The handled rail (anchor of the \"Executive handled N overnight\" pill) reads as the Executive reporting in, not an audit export: a first-person heading built from counts only — \"Since your last brief: N off your plate (resolved + dismissed closes still standing), N in others' hands (routed / nudged), N waiting on you (escalated)\" — then one first-person row per alert (\"Resolved *X* — evidence\", \"Dismissed *X* as stale — evidence\", \"Handed *X* to Dana Kim\" / \"Proposed *X* to Dana Kim (awaiting their approval)\", \"Chased Dana Kim on *X*\", \"Raised *X* to high\", \"Drafted *T* from *X*\", \"Folded *X* into *Y*\", \"Started watching *slug*\"). Escalations always sort first and never collapse; rows sharing an alert collapse to the newest move with the others as an \"also …\" trailer; a merge whose survivor is listed becomes \"N duplicates folded in\" on the survivor; five rows show before \"Show N more\", with workflow suggestions and stopped watches behind it by default. Every row links its `evidence_ref` (or \"evidence\") to `/audit?event_type=…&q=…` (the audit page pre-fills those filters from the query string), a still-open row jumps to its card (`#alert-<id>`), drafted rows link `/artifacts`, watch rows `/watchlist`. Undo is offered only while the close still stands (`status` not `open`); a reverted close shows \"Reopened\". A footer counts closes still standing (\"N fewer cards in your queue since your last brief · every close cites its evidence\"), and an empty rail with reviewed open alerts renders one line (\"Quiet night. I re-read N open alerts — none needed a move.\"). Dismissing a watch-sourced alert lowers that watch's `trust_score` (which discounts ranking and is shown to the review as evidence); the ack body may carry `mute_topic`.\n\n## Multi-client practice section\n\nIn multi-client practice mode (2+ client slots — see the Client Companies section), the response gains an additive `practice_clients` list: rollup cards for the **parked** clients (overdue follow-ups, awaiting replies, unread alerts, onboarding due soon, renewal countdowns), each stamped with the save point its data reflects. Single-company installs always receive an empty list and the UI renders nothing.",
+ "markdown": "`openexecutive.api.routes.today` serves the morning brief — a one-screen, read-only view of what is happening across the org. It is the default landing surface (the Next.js root renders `<Briefing>`).\n\n`GET /today` returns `TodayResponse` assembled by `_build_today()`, which is synchronous and caller-agnostic:\n\n- **`departments`** — per-department goal health, rolling up each department's goal counts (`total`, `at_risk`, `off_track`) plus its awaiting-workflow count, and `attention_goals`: the actual off-track/at-risk goals (worst first, capped at 3) with `key_result`, `current`, `target`, and `status`, so the briefing's Department card shows *which* goal is off and how far without a click. Empty for healthy/inactive departments.\n- **`people`** — an attention-ranked roster. Each person carries `awaiting_action` count, soonest SLA, a `status` (`on_leave` / `needs_reply` / `awaiting` / `clear`), reachability, `overdue`, a server `priority` sort key, and a cached one-line `insight`. Sorted by `(-priority, full_name)`.\n- **`proposals`** — the *live* unread alerts (workflow approvals, triage-classified inbound, Executive signals, flagged artifacts, and gated calendar bookings): unread, inside their category TTL, not snoozed — see *Alert lifecycle* below. Each carries `score`, `category` (`action` vs `monitoring`), `surfaced_reason` from `openexecutive.briefing.ranking`, the lifecycle fields (`occurrence_count`, `last_seen_at`, `last_reviewed_at`, `review_verdict`, `review_note`, `recommended_move`, `why_now`, `due_at`, `superseded_count`, `suggested_workflow`), and `decision_instance_id` (set only when the proposal is backed by a decision-ledger row — a calendar booking awaiting approval). The UI splits them into 'mine' vs 'across the team' using `caller_person_id`. For decision-backed proposals the card's Approve/Reject call the `/decisions` endpoints (which book or cancel the event server-side and clear the alert) instead of the ack-and-hand-off-to-chat flow — so meeting bookings are reviewed in the briefing itself rather than on a separate page.\n- **`narrative`** — a per-viewer Executive-voice header synthesized by `synthesize_briefing_narrative`; the principal gets the whole-company scope, teammates a role-scoped one. In the web UI each bullet of this narrative is a click target: clicking one hands off to chat (the same `onContinue` path as the proposal cards) seeded to discuss that item. The Executive recognizes it because every chat turn now carries a `<briefing>` digest of open alerts (see Memory).\n- **`in_flight`** / **`awaiting`** — upcoming Executive commitments and people we are waiting on.\n- **`handled_overnight`** — the autonomous moves the Executive *completed* since the last delivered morning brief: the alert review's (routed, nudged, escalated, drafted, merged, closed) plus the research watch policy's (`watching` — a watch added on its own because it was grounded in company data; `stopped_watching` — a research watch auto-disabled as noisy or dead; no alert id, re-enable from `/watchlist`). A `changed` verdict (the review rewrote an open alert's headline / body / severity) is deliberately **not** here: the alert is still open in \"Needs you\" and its card carries the note, so the brief reports it under \"what changed\" (a REWRITTEN block) rather than as done. Each row is structured, not just a sentence: `kind`, the audit `summary` (nudge bookkeeping marker stripped), `at`, `alert_id`, `event_type` (for a pre-filtered `/audit` deep link), `headline` (the alert's headline at move time; a watch's slug), `target` (person name for routed / nudged, survivor headline for merged, new severity for escalated, draft title, workflow name), `detail` (the cited evidence or the watch policy's reason), `outcome` (`resolved` | `dismissed` for a close, `proposed` for a route that went through the authority gate), `evidence_ref` (S1 / R2 / A3), `superseded_by_alert_id`, and `status` — the alert's lifecycle state **now** (`open` = live in the queue per `lifecycle.is_live` | `resolved` | `dismissed` | `expired` | `merged` | `acked` | `inactive` for snoozed / past-TTL rows), looked up per row so a close the principal already undid renders as reopened instead of offering a second Undo, and a \"still open\" jump link only appears when there is a card to land on. The morning brief also carries a one-line count of research watch suggestions waiting on `/watchlist`.\n- **`talent`** — the active executive-search pipeline, rolled up by `briefing.talent_digest.build_talent_brief_items`: one item per non-terminal engagement (FILLED/CANCELLED dropped) with role, department, status, candidate count, per-stage counts, and four attention signals — `offers_expiring_soon` (extended offers within 72h of `expires_at`, or past it with no decision recorded — computed straight from the offers table so a missed nudge can't make the briefing stale), `needs_screening` (leads), `offers_out` (offers), and `stalled_count` (active candidates not touched in ≥7 days). Items sort expiring → offers → stalled → leads → size. It renders as the briefing's **Executive search** card (one per search; click-to-discuss hands off to chat via the same `onContinue` path), feeds the narrative (an offer landing or a search going cold re-writes the header — the narrative cache hash folds a talent fingerprint), and the same digest's `format_talent_for_prompt` is appended to the chat `<briefing>` block so the Executive can discuss live searches by client or role. One rollup, shared by all four surfaces, so the card / header / chat never disagree. See the Talent section.\n\nThe route resolves the caller from `x-caller-email`, then attaches the viewer-scoped narrative in a `BackgroundTask` so the request never blocks on an LLM call. `GET /today/activity` returns the recent self-initiated action rail — merged from fired scheduled actions (DMs, follow-ups, nudges, cadences), logged decisions, saved advice, completed workflow runs (briefings/check-ins/research), kicked-off initiatives, resolved gated decisions, and raised alerts, so it reflects all of the Executive's activity rather than just dispatched messages. The Pulse page (`/memories`) polls it (limit 100) every ~20s so new events stream into the 'Recent activity' card, which scrolls internally at a fixed height instead of growing the page. The `morning_brief` workflow calls `_build_today()` directly to build the standalone DM (via a different, enumerated prompt). `GET /morning-brief` is a deprecated alias.\n\n## Alert lifecycle & the Executive review\n\nAlerts used to be write-once: raised, then never looked at again, so the \"Needs you\" queue grew without bound and the briefs re-listed it daily. Three things now keep it live:\n\n- **Time-to-live** (`openexecutive.alerts.lifecycle`). Action items expire after `ALERT_TTL_DAYS_ACTION` (14 d), unrouted low/medium monitoring signals after `ALERT_TTL_DAYS_MONITORING` (3 d). Every surface reads `list_live_alerts` (the same predicate the scheduler's 15-minute sweep persists as status `expired`), so `/today` is right even before the sweep runs. Artifacts and decision-backed alerts are exempt. `POST /alerts/{id}/reopen` is the Undo.\n- **Coalescing** (`alerts.pipeline` + `store.coalesce_alert`). A repeat of an open alert with the same `(source, dedup_key)` updates that row — `occurrence_count`, `last_seen_at`, severity max — instead of stacking a second card, and only re-pings when severity rose to high/urgent. Monitoring alerts carry a stable `watch:<slug>` key, so one watch means one card.\n- **The review** (`openexecutive.alerts.review`, heartbeat `alert_review_scan`, every 6 h and right before the morning brief). For each open alert the Executive sees what changed since it was raised — newer signals from the same watch, related alerts, activity since, the roster with SLAs, department authority — and returns a verdict (relevant / changed / resolved / stale) plus a recommended move. Deterministic policy then acts: **route** (assign + DM the owner; `propose_via_alert` for propose-only departments), **nudge**, **escalate** (severity + `due_at` + DM the principal only), **draft** (`draft_artifact`), **suggest a workflow** (a link, never a run), **merge** (`superseded_by_alert_id`), or **resolve** — only on high confidence citing a server-minted evidence ref (a newer signal, a related alert, an activity item shown for that alert); free text never closes a card, and anything weaker is annotated `likely_stale`, demoted 30 ranking points, and left for one click. Everything that came from outside is rendered as inert data inside the review prompt, so an injected email body cannot steer the batch. Board / comp / legal matters only ever go to a scope-holder or the principal and keep their text. Route and escalate are idempotent across passes, every DM carries an \"[Alert review] Re: …\" header, outbound moves are capped per pass, passes are single-flight, `ALERT_REVIEW_ENABLED=false` stops every caller, every move is audited with its evidence and prior state, and a distinct `resolved` status keeps Executive closes separate from `ack` (user approved).\n\nOn the page, cards read as decisions: the one-line \"what changed since you last looked\" (`review_note`) leads, the recommended move is the primary control (Nudge <owner> → chat; Run <workflow> → `/jobs/<name>`), with chips for age, seen ×N, why-now / due, folded-in and draft-ready, a \"Reviewed <ago>\" footer, and an amber Likely-stale treatment with one-click Dismiss. \"Needs you\" shows *Start here* + 8 cards + \"Show N more\", a \"Dismiss N older than 7 days\" footer (explicit ids to `POST /alerts/bulk-ack` — never a server-side age sweep, which would hit teammates' routed items), and \"Re-check relevance\" (`POST /alerts/review`). The handled rail (anchor of the \"Executive handled N overnight\" pill) reads as the Executive reporting in, not an audit export: a first-person heading built from counts only — \"Since your last brief: N off your plate (resolved + dismissed closes still standing), N in others' hands (routed / nudged), N waiting on you (escalated)\" — then one first-person row per alert (\"Resolved *X* — evidence\", \"Dismissed *X* as stale — evidence\", \"Handed *X* to Dana Kim\" / \"Proposed *X* to Dana Kim (awaiting their approval)\", \"Chased Dana Kim on *X*\", \"Raised *X* to high\", \"Drafted *T* from *X*\", \"Folded *X* into *Y*\", \"Started watching *slug*\"). Escalations sort first; rows sharing an alert collapse to the newest move with the others as an \"also …\" trailer — a close always keeps the visible slot (it carries Undo), otherwise an escalation beats routed / nudged / drafted; a merge whose survivor is listed becomes \"N duplicates folded in\" on the survivor; five rows show before \"Show N more\", with workflow suggestions and stopped watches behind it by default. Every row links its `evidence_ref` (or \"evidence\") to `/audit?event_type=…&q=…` (the audit page pre-fills those filters from the query string), a still-open row jumps to its card (`#alert-<id>`), drafted rows link `/artifacts`, watch rows `/watchlist`. Undo is offered only while the close still stands (`status` not `open`); a reverted close shows \"Reopened\". A footer counts closes still standing (\"N fewer cards in your queue since your last brief · every close cites its evidence\"), and an empty rail with reviewed open alerts renders one line (\"Quiet night. I re-read N open alerts — none needed a move.\"). Dismissing a watch-sourced alert lowers that watch's `trust_score` (which discounts ranking and is shown to the review as evidence); the ack body may carry `mute_topic`.\n\n## Multi-client practice section\n\nIn multi-client practice mode (2+ client slots — see the Client Companies section), the response gains an additive `practice_clients` list: rollup cards for the **parked** clients (overdue follow-ups, awaiting replies, unread alerts, onboarding due soon, renewal countdowns), each stamped with the save point its data reflects. Single-company installs always receive an empty list and the UI renders nothing.",
"mermaid": "flowchart TD\n REQ[\"GET /today\"]\n BUILD[\"_build_today()\"]\n DEPTS[\"departments<br/>(per-dept goal health)\"]\n ROSTER[\"people<br/>(attention-ranked roster)\"]\n PROPS[\"proposals<br/>(unread alerts, routed)\"]\n INFLIGHT[\"in_flight<br/>(pending follow-ups / nudges)\"]\n AWAIT[\"awaiting<br/>(replies we await)\"]\n TALENT[\"talent<br/>(open searches, by stage)\"]\n NARR[\"viewer-scoped narrative (BackgroundTask)\"]\n MB[\"morning_brief workflow\"]\n REQ --> BUILD\n BUILD --> DEPTS\n BUILD --> ROSTER\n BUILD --> PROPS\n BUILD --> INFLIGHT\n BUILD --> AWAIT\n BUILD --> TALENT\n REQ -->|\"resolve caller, attach\"| NARR\n MB -->|\"calls directly for standalone DM\"| BUILD\n class REQ entry\n class BUILD compute\n class DEPTS storage\n class ROSTER storage\n class PROPS storage\n class INFLIGHT storage\n class AWAIT storage\n class TALENT storage\n class NARR compute\n class MB compute",
"generated_at": "2026-09-13T00:00:00+00:00"
}
diff --git a/packages/core/openexecutive/briefing/brief_state.py b/packages/core/openexecutive/briefing/brief_state.py
index ae7189ac..6d8024b2 100644
--- a/packages/core/openexecutive/briefing/brief_state.py
+++ b/packages/core/openexecutive/briefing/brief_state.py
@@ -152,8 +152,10 @@ def rewritten_since(
for p in proposals:
if p.get("review_verdict") != "changed":
continue
+ # Fail open like split_proposals: a rewrite with no readable stamp is
+ # reported rather than dropped from every block.
reviewed = parse_aware(p.get("last_reviewed_at"))
- if reviewed is not None and reviewed >= since:
+ if reviewed is None or reviewed >= since:
out.append(p)
return out
@@ -216,18 +218,20 @@ def build_brief_fingerprint(
tomorrow (activity is keyed by kind + summary, never by its stamp)."""
new, carried = split_proposals(today_data.get("proposals", []), since)
payload = {
- "new": sorted(int(p.get("alert_id", 0)) for p in new),
- "carried": sorted(int(p.get("alert_id", 0)) for p in carried),
+ "new": sorted(int(p.get("alert_id") or 0) for p in new),
+ "carried": sorted(int(p.get("alert_id") or 0) for p in carried),
"likely_stale": sum(1 for p in carried if p.get("review_verdict") == "likely_stale"),
"activity": sorted(
(str(a.get("kind", "")), str(a.get("summary", ""))[:80]) for a in activity
),
"handled": sorted((h["kind"], h["summary"][:80]) for h in handled),
# A rewrite alone must still un-suppress the brief now that it no
- # longer rides in `handled` (keyed on the note, never the stamp).
+ # longer rides in `handled` (keyed on the note, never the stamp). Same
+ # list the REWRITTEN block renders: carried items only — a new item
+ # already moves the fingerprint by id.
"rewritten": sorted(
- (int(p.get("alert_id", 0)), str(p.get("review_note", ""))[:80])
- for p in rewritten_since(today_data.get("proposals", []), since)
+ (int(p.get("alert_id") or 0), str(p.get("review_note", ""))[:80])
+ for p in rewritten_since(carried, since)
),
"depts": sorted(
(d.get("slug", ""), d.get("at_risk_count", 0), d.get("off_track_count", 0))
diff --git a/packages/core/tests/unit/test_brief_state.py b/packages/core/tests/unit/test_brief_state.py
index 08502b01..495e041b 100644
--- a/packages/core/tests/unit/test_brief_state.py
+++ b/packages/core/tests/unit/test_brief_state.py
@@ -194,7 +194,8 @@ def test_rewritten_since_picks_changed_verdicts_reviewed_in_window() -> None:
{"alert_id": 3, "review_verdict": "relevant", "last_reviewed_at": inside},
{"alert_id": 4, "review_verdict": "changed"},
]
- assert [p["alert_id"] for p in brief_state.rewritten_since(proposals, since)] == [1]
+ # 4 has no stamp: reported (fail open, like split_proposals), never dropped.
+ assert [p["alert_id"] for p in brief_state.rewritten_since(proposals, since)] == [1, 4]
assert brief_state.rewritten_since(proposals, None) == []
diff --git a/packages/core/tests/unit/test_briefing_context_render.py b/packages/core/tests/unit/test_briefing_context_render.py
index 53ace04f..58ce496f 100644
--- a/packages/core/tests/unit/test_briefing_context_render.py
+++ b/packages/core/tests/unit/test_briefing_context_render.py
@@ -109,8 +109,9 @@ def test_render_context_lists_rewritten_open_items_separately_from_handled() ->
)
assert "REWRITTEN BY THE EXECUTIVE SINCE LAST BRIEF" in text
assert "- item 4 — payouts now delayed for 7 merchants" in text
- handled_block = text.split("HANDLED OVERNIGHT BY THE EXECUTIVE", 1)[1]
- assert "item 4" not in handled_block
+ # Listed exactly once, under REWRITTEN — not re-listed as new or carried.
+ assert text.count("item 4") == 1
+ assert text.index("REWRITTEN BY THE EXECUTIVE") < text.index("HANDLED OVERNIGHT BY THE EXECUTIVE")
# Rewritten items are still carried-over for the count.
assert "CARRIED OVER: 3 older item(s)" in text
diff --git a/packages/core/tests/unit/test_today_route.py b/packages/core/tests/unit/test_today_route.py
index 5215d44c..695ae3ae 100644
--- a/packages/core/tests/unit/test_today_route.py
+++ b/packages/core/tests/unit/test_today_route.py
@@ -1536,7 +1536,9 @@ def test_handled_overnight_rows_are_structured_and_track_current_status(
routed_id = _alert("Q3 pricing page copy stale")
survivor_id = _alert("Payout delay")
dup_id = _alert("Payout delay (duplicate)")
+ acked_id = _alert("SOC2 evidence request")
alert_store.set_status(closed_id, "resolved")
+ alert_store.set_status(acked_id, "ack")
alert_store.set_status(undone_id, "dismissed")
alert_store.mark_superseded(dup_id, survivor_id)
@@ -1553,6 +1555,9 @@ def test_handled_overnight_rows_are_structured_and_track_current_status(
al.log("alert_review_merged", "Merged 'Payout delay (duplicate)' into 'Payout delay'", actor="executive",
details={"alert_id": dup_id, "headline": "Payout delay (duplicate)",
"superseded_by_alert_id": survivor_id, "superseded_by_headline": "Payout delay"})
+ al.log("alert_review_escalated", "Escalated 'SOC2 evidence request' to high (sent)", actor="executive",
+ details={"alert_id": acked_id, "headline": "SOC2 evidence request", "new_severity": "high",
+ "evidence": "auditor deadline Friday"})
al.log("watchlist_research_added", "Started watching stock-acme — competitor ticker", actor="executive",
details={"slug": "stock-acme", "rationale": "competitor ticker named on Sales"})
al.log("alert_review_changed", "Updated 'Something' — rewritten", actor="executive",
@@ -1582,6 +1587,12 @@ def test_handled_overnight_rows_are_structured_and_track_current_status(
assert merged["target"] == "Payout delay" and merged["superseded_by_alert_id"] == survivor_id
assert merged["status"] == "merged"
+ # The principal approved this one after the escalation: not "open" (no
+ # card to jump to), not reopenable.
+ escalated = rows["SOC2 evidence request"]
+ assert escalated["target"] == "high" and escalated["detail"] == "auditor deadline Friday"
+ assert escalated["status"] == "acked"
+
watching = rows["stock-acme"]
assert watching["kind"] == "watching" and watching["alert_id"] is None
assert watching["detail"] == "competitor ticker named on Sales" and watching["status"] == ""
diff --git a/packages/ui/src/components/Briefing.tsx b/packages/ui/src/components/Briefing.tsx
index df958eb8..c74419ae 100644
--- a/packages/ui/src/components/Briefing.tsx
+++ b/packages/ui/src/components/Briefing.tsx
@@ -1402,7 +1402,7 @@ function MonitoringRow({
</>
);
return (
- <div className="relative group py-3 hover:bg-surface-overlay/30 transition-colors">
+ <div id={`alert-${proposal.alert_id}`} className="relative group py-3 hover:bg-surface-overlay/30 transition-colors">
{onContinue ? (
<button
type="button"
@@ -1528,8 +1528,10 @@ interface HandledRow {
// Collapse the newest-first list to one row per alert. A merge whose survivor
// is also listed becomes a "duplicate folded in" count on the survivor. The
-// newest move wins the visible slot, except an escalation, which always
-// stays visible — the boast must never bury the row that needs the CEO.
+// newest move wins the visible slot, with two overrides: a close (terminal,
+// and the row that carries Undo) is never hidden behind an older move, and
+// otherwise an escalation beats routed / nudged / drafted — the boast must
+// never bury the row that needs the CEO.
function groupHandled(items: HandledItem[]): HandledRow[] {
const listed = new Set(items.map((h) => h.alert_id).filter((id): id is number => id != null));
const foldedInto = new Map<number, number>();
@@ -1555,7 +1557,7 @@ function groupHandled(items: HandledItem[]): HandledRow[] {
};
byKey.set(key, fresh);
rows.push(fresh);
- } else if (h.kind === "escalated" && row.item.kind !== "escalated") {
+ } else if (h.kind === "escalated" && !isCloseKind(row.item) && row.item.kind !== "escalated") {
row.also.push(row.item);
row.item = h;
} else {
@@ -1583,7 +1585,7 @@ function handledHeadline(rows: HandledRow[], reverted: (h: HandledItem) => boole
let waiting = 0;
for (const r of rows) {
const k = r.item.kind;
- if (k === "closed" && !reverted(r.item)) offPlate += 1;
+ if (isCloseKind(r.item) && !reverted(r.item)) offPlate += 1;
else if (k === "routed" || k === "nudged") others += 1;
else if (k === "escalated") waiting += 1;
}
@@ -1634,8 +1636,14 @@ function handledSentence(h: HandledItem): React.ReactNode {
}
}
+// Statuses `POST /alerts/{id}/reopen` accepts, plus "" for an unknown lookup.
+const HANDLED_REOPENABLE = new Set(["", "resolved", "dismissed", "expired", "merged"]);
+
+// Jump to the alert's card; when it is folded behind "Show more" (no element
+// yet), land on the queue section instead of clicking dead.
function scrollToAlertCard(alertId: number) {
- document.getElementById(`alert-${alertId}`)?.scrollIntoView({ behavior: "smooth", block: "center" });
+ const target = document.getElementById(`alert-${alertId}`) ?? document.getElementById(SECTION_IDS.needsYou);
+ target?.scrollIntoView({ behavior: "smooth", block: "center" });
}
// The audit page pre-filters on these two query params, so the row's
@@ -1650,7 +1658,7 @@ function handledProofHref(h: HandledItem): string | null {
function handledAlsoLine(row: HandledRow): string {
const parts: string[] = [];
if (row.foldedIn > 0) parts.push(`${row.foldedIn} duplicate${row.foldedIn === 1 ? "" : "s"} folded in`);
- if (row.also.length > 0) parts.push(`also ${row.also.map((a) => handledVerb(a.kind)).join(", ")} earlier`);
+ if (row.also.length > 0) parts.push(`also ${row.also.map((a) => handledVerb(a.kind)).join(", ")}`);
return parts.join(" · ");
}
@@ -1673,7 +1681,12 @@ function HandledRowView({
onReopen?: (rowKey: string, alertId: number) => void;
}) {
const h = row.item;
- const canUndo = Boolean(onReopen) && h.alert_id != null && isCloseKind(h) && !reverted;
+ // Undo only while the close still stands and the server would accept a
+ // reopen (resolved / dismissed / expired / merged; "" = status unknown).
+ const canUndo =
+ Boolean(onReopen) && h.alert_id != null && isCloseKind(h) && !reverted && HANDLED_REOPENABLE.has(h.status ?? "");
+ // "open" means live in the queue right now — the only state with a card to
+ // jump to (an acked or snoozed alert has none).
const stillOpen = h.alert_id != null && h.status === "open" && !isCloseKind(h);
const proofHref = handledProofHref(h);
const alsoLine = handledAlsoLine(row);
@@ -1756,9 +1769,12 @@ function HandledOvernightPanel({
const rows = groupHandled(items);
const loud = rows.filter((r) => !isQuietKind(r.item.kind));
const quiet = rows.filter((r) => isQuietKind(r.item.kind));
- const visible = showAll ? [...loud, ...quiet] : loud.slice(0, HANDLED_VISIBLE);
+ // Quiet rows hide behind "Show more" only when there is something louder
+ // to show first; a rail of nothing but suggestions still lists them.
+ const primary = loud.length > 0 ? loud : quiet;
+ const visible = showAll ? [...loud, ...quiet] : primary.slice(0, HANDLED_VISIBLE);
const hiddenCount = rows.length - visible.length;
- const closesStanding = rows.filter((r) => r.item.kind === "closed" && !reverted(r.item)).length;
+ const closesStanding = rows.filter((r) => isCloseKind(r.item) && !reverted(r.item)).length;
return (
<section id={SECTION_IDS.handled} className="rounded-xl border border-line bg-surface-elevated p-4">
@@ -2075,7 +2091,7 @@ export default function Briefing({ onContinue, showHeader = false, firstName }:
const statPills: StatPill[] = today
? briefingStats({
needsYou: mineProposals.length,
- handledOvernight: handledOvernight.length,
+ handledOvernight: groupHandled(handledOvernight).length,
peopleOverdue,
peopleNeedReply,
deptAtRisk: deptAtRiskCount,