Files
cleveragents-core/.opencode/telemetry/style.css
T
drew 0db0a15dad feat(controller): RUN_CI_LOCAL verdict source, ci-not-ready outcome, escalation hardening
Adds RUN_CI_LOCAL — an on-demand local-CI verdict source for when the
cluster's Forgejo CI is broken — plus robustness fixes, the telemetry
Live-tab rewrite, and PR-level cost attribution.

Controller:
- RUN_CI_LOCAL: the master swaps its Forgejo CI callbacks for local
  `forgejo-runner exec` runs (tools/run-ci-full-local.sh + local_ci.py).
  Async per-(owner,repo,SHA) on-disk job cache; preflights the
  forgejo-runner binary + Docker daemon at startup (fail loud, not a
  red verdict on every PR); GCs finished run dirs + per-run actcache.
- ci-not-ready implementer outcome + implementer_ci_not_ready event:
  an implementer that runs before the on-demand verdict exists parks
  in AWAITING_CI instead of dead-ending at STUCK; capped against
  ci_red ping-pong.
- ci_poll_exhaustion skips its sweep while a local CI run is in
  flight, so AWAITING_CI workflows queued behind on-demand CI are not
  STUCK'd by the remote-CI-sized timeout.
- Escalate the workflow after repeated worker-internal-error at a
  tier instead of retrying to pickup-exhaustion -> STUCK.
- forgejo_http: normalise Forgejo's per-gate `status` key to `state`
  so failing gates are actually counted (they previously all read as
  pending).
- Per-tier worker timeouts bumped +15 min; a timed-out attempt's
  dirty-worktree residue is preserved on auto-scratch/pr-<N> before
  the next attempt's reset.
- Implementer agents now verify only the CI-flagged gate(s) via a
  targeted re-run rather than the full local battery before claiming
  resolved/noop. Re-running the whole suite CI will run anyway was the
  #1 cause of implementer timeouts; CI remains the real gate and
  re-dispatches the implementer on red.

Telemetry:
- Live tab rebuilt on /api/live (controller DB run state + the live
  OpenCode session forest) after the live_log_writer sidecar was
  retired with the legacy dispatchers.
- Durable per-attempt input/output payloads surfaced in the Live
  drill-down, archived-session detail, and Workflows timeline.
- PR-level cost attribution: worker session tags carry -pr-<n>;
  backfill_llm_activity_pr.py repairs rows written before the fix.

Shared:
- tools/controller/session_tag.py — one canonical controller-tag
  parser shared by the telemetry server and the backfill.

Tests: new coverage for local_ci (state machine, log parsing,
_summarize_run, GC, in-flight probe, preflight), the ci-not-ready
path, the escalation/ci-not-ready SQL counters, the ci_poll
in-flight skip, and CI-status payload parsing across both sources.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 11:49:05 -04:00

810 lines
20 KiB
CSS

/* Pipeline Telemetry Console — minimal, system-font, dark/light aware. */
:root {
--bg: #ffffff;
--bg-soft: #f5f5f7;
--bg-card: #ffffff;
--fg: #1a1a1a;
--fg-muted: #6b6b73;
--fg-soft: #2c2c34;
--border: #e5e5ea;
--accent: #1f6feb;
--ok: #16a34a;
--warn: #d97706;
--err: #dc2626;
--pulse: #1f6feb;
--code-bg: #f1f3f5;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d0d10;
--bg-soft: #15151a;
--bg-card: #181820;
--fg: #e8e8eb;
--fg-muted: #8a8a93;
--fg-soft: #cfcfd6;
--border: #26262e;
--accent: #58a6ff;
--ok: #4ade80;
--warn: #fbbf24;
--err: #f87171;
--pulse: #58a6ff;
--code-bg: #1f1f27;
}
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font-size: 14px;
line-height: 1.45;
}
code { background: var(--code-bg); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
pre { background: var(--code-bg); padding: 8px; border-radius: 4px; overflow-x: auto; font-size: 0.85em; }
.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.sep { color: var(--fg-muted); margin: 0 6px; }
.hidden { display: none !important; }
/* ── topbar ────────────────────────────────────────────────────── */
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 18px;
background: var(--bg-soft);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 10;
}
.brand { display: flex; align-items: center; gap: 6px; }
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--fg-muted);
}
.dot-pulse {
background: var(--pulse);
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.4; transform: scale(0.85); }
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); animation: pulse 1s infinite; }
.meta-extra { display: flex; align-items: center; }
/* ── tabs ──────────────────────────────────────────────────────── */
.tabs {
display: flex;
gap: 4px;
padding: 0 12px;
border-bottom: 1px solid var(--border);
background: var(--bg);
position: sticky;
top: 41px;
z-index: 9;
}
.tab {
background: transparent;
border: none;
border-bottom: 2px solid transparent;
padding: 10px 14px;
cursor: pointer;
font: inherit;
color: var(--fg-muted);
}
.tab:hover { color: var(--fg); }
.tab.active {
color: var(--fg);
border-bottom-color: var(--accent);
}
main { padding: 18px; }
.pane { display: none; }
.pane.active { display: block; }
.pane h2 { margin: 0 0 4px 0; font-size: 18px; }
.pane h3 { margin: 16px 0 8px 0; font-size: 14px; }
.pane p { margin: 0 0 12px 0; }
/* ── cards ─────────────────────────────────────────────────────── */
.card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 6px;
margin-bottom: 12px;
overflow: hidden;
}
.card-head {
padding: 8px 12px;
background: var(--bg-soft);
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
font-size: 13px;
}
.card-body { padding: 10px 12px; }
.card.placeholder { padding: 16px; color: var(--fg-muted); }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
@media (max-width: 900px) {
.grid-2, .grid-4 { grid-template-columns: 1fr; }
}
/* daemon mini-card */
.daemon {
display: flex;
flex-direction: column;
gap: 4px;
padding: 12px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 6px;
font-size: 13px;
}
.daemon .name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.daemon .pid { color: var(--fg-muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.daemon .hb { font-size: 11px; color: var(--fg-muted); }
.daemon.down { border-color: var(--err); }
.daemon.stale { border-color: var(--warn); }
.daemon.up { border-color: var(--ok); }
/* "long worker" — pid alive but heartbeat stale (callback regressed
or filesystem failure on the heartbeat path). Same hue as ``stale``
but a striped border so it reads as a distinct sub-state. */
.daemon.long-worker {
border-color: var(--warn);
border-style: dashed;
}
.daemon .in-flight {
font-size: 11px;
color: var(--ok);
font-family: ui-monospace, "SF Mono", Menlo, monospace;
margin-top: 2px;
}
.daemon .in-flight .mono { color: var(--fg); }
/* in-flight rows in the cycles tables (ended_at IS NULL): tinted
background so a long-running cycle is impossible to miss while
scanning the dispatcher table. */
tr.in-flight-row > td {
background: color-mix(in srgb, var(--warn) 12%, transparent);
}
/* tables */
.table-wrap { overflow-x: auto; }
table.tt {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
table.tt th, table.tt td {
text-align: left;
padding: 6px 10px;
border-bottom: 1px solid var(--border);
vertical-align: top;
}
table.tt th {
background: var(--bg-soft);
font-weight: 600;
position: sticky;
top: 0;
}
table.tt tr:hover td { background: var(--bg-soft); }
/* Numeric columns: header + data both centered so the data lines up
under its column header. tabular-nums keeps digit columns even. */
table.tt th.num, table.tt td.num { text-align: center; }
table.tt td.num { font-variant-numeric: tabular-nums; }
/* outcome / state pills */
.pill {
display: inline-block;
padding: 1px 8px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
background: var(--bg-soft);
color: var(--fg-soft);
border: 1px solid var(--border);
}
.pill.ok { background: rgba(22, 163, 74, 0.15); color: var(--ok); border-color: rgba(22, 163, 74, 0.3); }
.pill.warn { background: rgba(217, 119, 6, 0.15); color: var(--warn); border-color: rgba(217, 119, 6, 0.3); }
.pill.err { background: rgba(220, 38, 38, 0.15); color: var(--err); border-color: rgba(220, 38, 38, 0.3); }
.pill.info { background: rgba(31, 111, 235, 0.15); color: var(--accent); border-color: rgba(31, 111, 235, 0.3); }
.callout {
background: rgba(217, 119, 6, 0.10);
border: 1px solid rgba(217, 119, 6, 0.30);
color: var(--fg);
padding: 10px 12px;
border-radius: 6px;
margin-top: 12px;
}
.filter-row {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 10px;
}
.filter-row select {
padding: 4px 6px;
background: var(--bg);
color: var(--fg);
border: 1px solid var(--border);
border-radius: 4px;
font: inherit;
}
ul.tight { margin: 0; padding-left: 20px; }
ul.tight li { margin: 3px 0; }
dl { margin: 0; }
dl dt { font-weight: 600; margin-top: 6px; }
dl dt:first-of-type { margin-top: 0; }
dl dd { margin-left: 0; color: var(--fg-soft); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; }
/* large number stat */
.stat {
display: flex;
flex-direction: column;
padding: 14px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 6px;
}
.stat .v { font-size: 22px; font-weight: 600; }
.stat .l { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }
.stat .v.ok { color: var(--ok); }
.stat .v.warn { color: var(--warn); }
.stat .v.err { color: var(--err); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* ── Sessions tab (archived worker sessions) ─────────────────────── */
tr.clickable { cursor: pointer; }
tr.clickable:hover {
background: var(--bg-hover, rgba(255, 255, 255, 0.04));
}
.kv {
display: grid;
grid-template-columns: max-content 1fr;
column-gap: 12px;
row-gap: 4px;
margin: 0 0 12px 0;
}
.kv dt {
color: var(--fg-muted);
font-size: 12px;
}
.kv dd {
margin: 0;
font-family: var(--mono, monospace);
font-size: 13px;
}
.btn {
background: transparent;
border: 1px solid var(--border, #333);
color: var(--fg, #ddd);
padding: 2px 8px;
font-size: 12px;
border-radius: 4px;
cursor: pointer;
}
.btn-link {
border: none;
color: var(--accent);
padding: 2px 4px;
}
.btn-link:hover { text-decoration: underline; }
pre.archive-msg {
background: var(--bg-code, rgba(255, 255, 255, 0.04));
padding: 8px;
border-radius: 4px;
max-height: 500px;
overflow: auto;
font-size: 11px;
line-height: 1.4;
}
details + details { margin-top: 4px; }
details summary {
cursor: pointer;
font-family: var(--mono, monospace);
font-size: 12px;
color: var(--fg-muted);
padding: 2px 0;
}
details[open] summary { color: var(--fg, #ddd); }
/* ── Live tab ──────────────────────────────────────────────────────── */
.live-layout {
display: grid;
grid-template-columns: 280px 1fr;
gap: 16px;
min-height: 70vh;
}
.live-runs {
border-right: 1px solid var(--border);
padding-right: 12px;
}
.live-runs-head {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 8px;
}
.live-runs-list {
display: flex;
flex-direction: column;
gap: 4px;
max-height: 70vh;
overflow-y: auto;
}
.live-run-row {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border: 1px solid var(--border);
border-radius: 4px;
cursor: pointer;
background: var(--bg-card);
}
.live-run-row:hover {
background: var(--bg-soft);
}
.live-run-row.selected {
border-color: var(--accent);
background: var(--bg-soft);
}
.live-run-row .live-run-id {
flex: 1;
font-family: monospace;
font-size: 12px;
word-break: break-all;
line-height: 1.3;
}
.live-run-row .live-run-meta {
font-size: 11px;
color: var(--fg-muted);
margin-top: 2px;
}
.live-runs-foot {
margin-top: 12px;
border-top: 1px solid var(--border);
padding-top: 8px;
}
.live-panel {
display: flex;
flex-direction: column;
gap: 12px;
}
.live-empty {
padding: 40px;
text-align: center;
}
.live-runhead {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 12px;
flex-wrap: wrap;
padding-bottom: 8px;
border-bottom: 1px solid var(--border);
}
.live-runhead h3 { margin: 0; font-size: 16px; }
.live-runhead .live-countdown { font-family: monospace; font-size: 13px; }
.live-grid-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.live-grid-row.three { grid-template-columns: 1fr 1fr 1fr; }
.live-card {
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg-card);
}
.live-card-head {
padding: 6px 10px;
border-bottom: 1px solid var(--border);
font-weight: 600;
font-size: 12px;
display: flex;
justify-content: space-between;
align-items: baseline;
}
.live-card-body { padding: 10px; }
.live-proc-row {
display: grid;
grid-template-columns: auto 1fr auto;
gap: 6px;
align-items: center;
padding: 4px 0;
border-bottom: 1px solid var(--border);
font-size: 12px;
}
.live-proc-row:last-child { border-bottom: none; }
.live-proc-row .live-proc-name { font-weight: 600; font-family: monospace; }
.live-proc-row .live-proc-detail {
font-family: monospace;
font-size: 11px;
color: var(--fg-muted);
}
.live-proc-row.dead .live-proc-name { color: var(--err); }
.live-phase-badge {
display: inline-block;
padding: 4px 10px;
border-radius: 4px;
font-family: monospace;
font-weight: 600;
background: var(--accent);
color: white;
font-size: 13px;
letter-spacing: 0.04em;
}
.live-phase-badge.idle { background: var(--fg-muted); }
.live-phase-badge.failed,
.live-phase-badge.transport-error { background: var(--err); }
.live-phase-badge.short_circuit { background: var(--ok); }
.live-kv {
display: grid;
grid-template-columns: max-content 1fr;
gap: 4px 10px;
font-size: 12px;
margin: 8px 0 0;
}
.live-kv dt { color: var(--fg-muted); }
.live-kv dd { margin: 0; font-family: monospace; }
.live-feed {
max-height: 420px;
overflow-y: auto;
font-family: monospace;
font-size: 11px;
line-height: 1.5;
}
.live-feed-row {
padding: 3px 8px;
border-bottom: 1px solid var(--border);
display: grid;
grid-template-columns: 96px 130px 60px 1fr;
gap: 8px;
align-items: baseline;
}
.live-feed-row:last-child { border-bottom: none; }
.live-feed-row .ts { color: var(--fg-muted); white-space: nowrap; }
.live-feed-row .ty { font-weight: 600; }
.live-feed-row .sev-debug { color: var(--fg-muted); }
.live-feed-row .sev-info { color: var(--fg-soft); }
.live-feed-row .sev-warn { color: var(--warn); }
.live-feed-row .sev-error { color: var(--err); }
.live-feed-row .sev-critical { color: var(--err); font-weight: 700; }
.live-feed-filter {
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 6px;
font-size: 12px;
flex-wrap: wrap;
}
.live-feed-filter input[type=text] {
flex: 1;
min-width: 120px;
padding: 3px 6px;
border: 1px solid var(--border);
border-radius: 3px;
background: var(--bg);
color: var(--fg);
font-family: monospace;
font-size: 11px;
}
.live-errors-row {
padding: 4px 0;
border-bottom: 1px solid var(--border);
font-size: 12px;
}
.live-errors-row:last-child { border-bottom: none; }
.live-errors-row .ts { color: var(--fg-muted); font-size: 11px; font-family: monospace; }
/* ── Session tree + transcript (Live tab) ─────────────────────────── */
.live-sessions-row {
grid-template-columns: 360px 1fr;
}
.live-sessions-tree-card { max-height: 60vh; overflow-y: auto; }
.live-sessions-detail-card { max-height: 60vh; overflow-y: auto; }
.live-session-branch { display: flex; flex-direction: column; }
.live-session-node {
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 6px;
align-items: center;
padding: 4px 8px;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
line-height: 1.3;
}
.live-session-node:hover { background: var(--bg-soft); }
.live-session-node.selected {
background: var(--bg-soft);
outline: 1px solid var(--accent);
}
.live-session-head { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.live-session-agent { font-weight: 600; }
.live-session-tag {
font-family: monospace;
font-size: 11px;
color: var(--fg-muted);
}
.live-session-model {
font-size: 11px;
color: var(--fg-muted);
font-style: italic;
}
.live-session-status {
font-size: 10px;
padding: 1px 6px;
border-radius: 3px;
background: var(--fg-muted);
color: white;
font-family: monospace;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.live-session-status.running { background: var(--ok); }
.live-session-status.starting { background: var(--accent); }
.live-session-status.idle { background: var(--warn); }
.live-session-status.done { background: var(--fg-muted); }
.live-session-status.failed { background: var(--err); }
.live-session-meta { white-space: nowrap; font-size: 11px; }
.live-session-tier-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: 3px;
background: var(--accent);
color: white;
font-family: monospace;
font-weight: 600;
letter-spacing: 0.04em;
}
.live-session-detail { display: flex; flex-direction: column; gap: 10px; }
.live-session-detail-head {
display: flex;
gap: 10px;
align-items: baseline;
padding-bottom: 6px;
border-bottom: 1px solid var(--border);
flex-wrap: wrap;
}
.live-turn {
border-left: 3px solid var(--border);
padding: 8px 10px;
background: var(--bg-soft);
border-radius: 0 4px 4px 0;
}
.live-turn.role-user { border-left-color: var(--accent); }
.live-turn.role-assistant { border-left-color: var(--ok); }
.live-turn-head {
display: flex;
gap: 8px;
align-items: baseline;
margin-bottom: 6px;
font-size: 11px;
}
.live-turn-role {
font-weight: 700;
text-transform: uppercase;
font-size: 10px;
letter-spacing: 0.05em;
}
.live-turn-role.role-user { color: var(--accent); }
.live-turn-role.role-assistant { color: var(--ok); }
.live-part { margin: 6px 0; font-size: 13px; line-height: 1.45; }
.live-part-text { white-space: pre-wrap; word-wrap: break-word; }
.live-part-reasoning {
background: var(--bg-card);
padding: 6px 10px;
border-radius: 3px;
font-style: italic;
color: var(--fg-muted);
white-space: pre-wrap;
}
.live-part-reasoning .live-part-label {
font-size: 10px;
text-transform: uppercase;
font-style: normal;
margin-right: 8px;
letter-spacing: 0.05em;
}
.live-part-tool {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 4px;
padding: 6px 10px;
}
.live-tool-head {
display: flex;
gap: 8px;
align-items: baseline;
margin-bottom: 4px;
font-size: 12px;
}
.live-tool-name {
font-family: monospace;
font-weight: 700;
color: var(--accent);
}
.live-tool-status {
font-size: 10px;
text-transform: uppercase;
padding: 1px 6px;
border-radius: 3px;
background: var(--fg-muted);
color: white;
}
.live-tool-status.completed { background: var(--ok); }
.live-tool-status.error { background: var(--err); }
.live-tool-block { margin-top: 4px; font-size: 11px; }
.live-tool-block summary {
cursor: pointer;
color: var(--fg-muted);
font-family: monospace;
}
.live-tool-block pre {
margin: 4px 0 0;
padding: 6px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 3px;
overflow-x: auto;
font-size: 11px;
white-space: pre-wrap;
word-wrap: break-word;
max-height: 240px;
overflow-y: auto;
}
/* Live tab — controller status bar (rebuilt 2026-05 on /api/live). */
.live-controlbar {
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px 12px;
margin-bottom: 14px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg-card);
}
.live-cb-line {
display: flex;
gap: 8px;
align-items: baseline;
flex-wrap: wrap;
font-size: 13px;
}
.live-cb-chips {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.live-chip {
display: inline-flex;
gap: 6px;
align-items: baseline;
padding: 2px 8px;
border: 1px solid var(--border);
border-radius: 3px;
background: var(--bg-soft);
font-size: 11px;
}
.live-chip.ok { border-color: var(--ok); }
.live-chip.warn { border-color: var(--warn); }
.live-chip.err { border-color: var(--err); }
.live-chip.att { border-style: dashed; }
.live-hb-stale {
color: var(--err);
font-weight: 600;
font-size: 11px;
}
/* Attempt payloads — durable controller-DB input/output, shared by the
Live drill-down, Archived-session detail, and Workflows timeline. */
.attempt-payloads {
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg-card);
padding: 8px 10px;
margin: 8px 0;
}
.attempt-payloads-head {
display: flex;
gap: 8px;
align-items: baseline;
flex-wrap: wrap;
margin-bottom: 6px;
}
.attempt-payloads details { margin-top: 4px; }
.attempt-payloads summary {
cursor: pointer;
color: var(--fg-muted);
font-family: monospace;
font-size: 12px;
}
.payload-pre {
margin: 4px 0 0;
padding: 8px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 3px;
overflow: auto;
max-height: 360px;
font-size: 11px;
white-space: pre-wrap;
word-wrap: break-word;
}
.live-feed-toggle {
font-size: 11px;
padding: 2px 8px;
border: 1px solid var(--border);
border-radius: 3px;
background: var(--bg-card);
color: var(--fg-muted);
cursor: pointer;
font-family: monospace;
}
.live-feed-toggle.on {
background: var(--accent);
color: white;
border-color: var(--accent);
}
.live-feed-msg { flex: 1; }