← Back to Pull requests

fix: control plane and UI fixes #1171

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 09, 2026 14:31 UTC
Author

Summary

All fixes in one PR, for one review. It replaces #1169, #1170 and #1172, which are closed in favour of this one; their commits are merged here unchanged.

| Fix | What was broken | Originally |
| --- | --- | --- |
| Execution VC created_at stored in UTC, plus a one-time SQLite rewrite of old rows | On SQLite, VC created_at was written in the host's local zone while the VC filters bind a UTC bound and compare text, so on hosts west of UTC a fresh VC fell out of created_after and rows written under different offsets sorted out of order; the API returned local-zone timestamps | #1170 |
| API key on direct fetch calls (Integrations, Triggers, trigger sheet/dialog/event replay, step approvals, DAG sidebar, retry panel, DID bundle download) | With AGENTFIELD_API_KEY set, pages that call fetch directly sent no X-API-Key and got 401 | #1169 |
| Playground replay unwraps the stored {"input": …} envelope | Replaying a run sent {"input":{"input":{…}}}, so the reasoner received none of its arguments and ran on defaults | #1169 |
| Playground "View run" opens the run | The button navigated to /runs/<execution_id>, which is a 404 | #1169 |
| Runs list picks its page before aggregating; default page read from a new activity index | /api/ui/v2/workflow-runs grouped every execution in the table on each request: ~285 ms with no traffic and ~440 ms p50 under traffic on a 203k-execution database. Now ~25 ms and ~56 ms | #1172 |
| Live refreshes coalesced; a running run polls every 10 s while the stream is connected | Each execution event restarted the runs list, dashboard, DAG and step queries with cancelRefetch, so under load the Runs page made ~30 overlapping list requests in 15 s | #1172 |
| Run page fetches vc-chain?view=summary | The run page downloaded the whole VC chain (1.2 MB for a 1,500-step run) to show a verifiability warning and the issuer | #1172 |
| Execution started_at stored in UTC | On SQLite, a start time not in UTC was compared as local-zone text, so it dropped out of a UTC since filter and sorted by the wrong instant | #1172 |

fix/control-plane-and-ui-fixes
├── merge fix/execution-vc-utc-timestamps   (#1170)
├── merge fix/web-direct-fetch-auth         (#1169)
└── merge fix/runs-list-under-load          (#1172)

No conflicts between the three.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

  • New feature

  • Breaking change

  • Documentation update
  • Evidence

    End-to-end run: embedded server built from each branch (go build -tags embedded), fresh home directory, AGENTFIELD_STORAGE_MODE=local, AGENTFIELD_API_KEY set, host zone America/Toronto (UTC-5), two agents from examples/python_agent_nodes (permission_agent_b, hello_world), calls executed through /api/v1/execute, UI driven in headless Chrome.

    VC timestamps

    Before (main binary, fresh database):

    sqlite> select created_at from execution_vcs;
    2026-11-09 09:27:26.74224661-05:00
    GET /api/ui/v1/executions/<id>/vc  -> "created_at": "2026-11-09T09:27:26.74224661-05:00"
    

    After (this branch started on the same database main created):

    log: {"rows":3,"message":"Rewrote execution VC created_at to UTC"}
    sqlite> select created_at from execution_vcs;
    2026-11-09 14:27:26.74224661+00:00          (same instant)
    GET /api/ui/v1/executions/<id>/vc  -> "created_at": "2026-11-09T14:27:26.74224661Z"
    new execution on this build        -> 2026-11-09 14:28:04.781845814+00:00
    second restart                     -> no rewrite log line; schema_migrations has exactly one execution_vcs_utc_created_at row
    

    Runs list and run page under traffic

    Measured on a copy of a busy local SQLite database: 4.2 GB, about 24,000 runs and 203,000 executions. Live traffic came from a real agent through /api/v1/execute/async: one 1,500-step run (six steps in parallel) plus a new 5-step run about every 0.66 s. The machine's load average was about 20 from unrelated work, so these are noisy-box numbers.

    GET /api/ui/v2/workflow-runs?page=1&page_size=25&sort_by=updated_at&sort_order=desc

    | | Before | After |
    | --- | --- | --- |
    | no traffic, p50 | 285 ms | 25 ms |
    | under traffic, p50 / p90 / max (20 samples) | 441 / 509 / 549 ms | 56 / 67 / 73 ms |
    | QueryRunSummaries alone, default page | 320 ms | 20 ms (most of it the COUNT(DISTINCT run_id) total) |
    | QueryRunSummaries, other sort columns | ~320 ms | 35–135 ms |

    The per-run lookups in the handler (run metadata and trigger) were measured at about 1–3 ms for a page of 25, so they were left as they are.

    Network trace, 15 s on each page under traffic (headless Chrome, /api requests only)

    Runs page:

    before coalescing (measured earlier on the same data):
      ~30 x workflow-runs in 15 s, overlapping and cancelled, 0.3 s -> 2.7 s each
    coalesced, old query:
      9 x workflow-runs   332-446 ms, 18 KB each
    coalesced, new query:
      9 x workflow-runs    45-101 ms, 18 KB each
      plus dashboard/summary x1, nodes/summary x1, llm/health x3, queue/status x3, one event stream
    

    Run page of the 1,500-step run while it runs:

    before:
      dag?mode=lightweight   16 ms   143 KB
      vc-chain               31 ms  1220 KB      <- whole chain, fetched on every page open
      dag?mode=lightweight   x7 more in 15 s (one per coalesced flush), 11-18 ms, ~150-180 KB
    after:
      dag?mode=lightweight   20 ms   135 KB
      vc-chain?view=summary  45 ms     1 KB
      dag?mode=lightweight   x6 more in 15 s, 11-23 ms, ~140-170 KB
      executions/:id/details x2, nodes/summary x1, llm/health x3, queue/status x3, one event stream
    

    For a 322-step run, the full chain was 766 KB.

    Test plan (runs list, UTC start time, VC summary)

  • go build ./...

  • go vet ./internal/storage ./internal/handlers/ui

  • go test ./internal/storage/ ./internal/handlers/ui/ ./internal/server/ -count=1

  • POSTGRES_TEST_URL=... go test ./internal/storage -run Postgres -count=1 against pgvector/pgvector:pg17, including the new PostgreSQL page comparison

  • New TestQueryRunSummariesPagesMatchTheSingleGroupedQuery compares every sort column, both directions, ten filters and five page windows against the previous single grouped query. It fails if either tie-breaker is reversed.

  • New TestRecentRunIDsByActivityWidensPastBusyRuns, TestRunActivityIndexServesTheRecentRunsScan

  • New TestExecutionStartedAtIsStoredInUTC fails on main (a non-UTC start drops out of a UTC since filter) and passes here

  • New TestUIWorkflowVCChainSummaryViewOmitsPerStepCredentials

  • web/client: npx tsc --noEmit -p tsconfig.app.json, npx vitest run (141 files, 840 tests), npm run build
  • Integrations page with an API key

    | | /api/v1/sources | /api/v1/triggers | Page |
    | --- | --- | --- | --- |
    | Before | 401 | 401 | HTTP 401: {"error":"unauthorized",…} |
    | After | 200 | 200 | loads, no error |

    Run detail → Replay → Execute → View run

    | | Replay input box | Stored execution input | Result | View run |
    | --- | --- | --- | --- | --- |
    | Before | {"input": {"limit": 3, "query": "SELECT 3"}} | {"input":{"input":{"limit":3,"query":"SELECT 3"}}} | ran on defaults: "query":"SELECT *","limit":100 | /ui/runs/exec_… → HTTP error! status: 404 |
    | After | {"limit": 3, "query": "SELECT 3"} | {"input":{"limit":3,"query":"SELECT 3"}} | "query":"SELECT 3","limit":3 | /ui/runs/run_… → run page renders |

    Test plan

  • cd control-plane && go build ./...

  • go vet ./...

  • go test ./internal/storage/ ./internal/services/ ./internal/handlers/... -count=1 (re-run after merging #1172)

  • cd web/client && npx tsc --noEmit -p tsconfig.app.json

  • npx vitest run (141 files, 840 tests passed, after merging #1172)

  • npm run build

  • go build -tags embedded ./cmd/agentfield-server, run on a fresh home with an API key, two example agents registered, executions via /api/v1/execute

  • Headless Chrome: Integrations loads, Replay → Execute succeeds with the replayed arguments, View run opens the run

  • Started this build on a database created by main's binary; rows rewritten to UTC once; second restart is a no-op
  • Merge Danger

    Door: one-way — #1170 rewrites existing SQLite execution_vcs.created_at values to UTC on first start (same instant, different spelling; not reverted by downgrading). The #1169 web changes are two-way.

    The #1172 changes are two-way: the new executions index is additive, and view=summary is opt-in.

    Blast Radius: low — one column of one table on SQLite only (Postgres untouched), recorded in schema_migrations so it runs once; the web changes add a header to direct fetches and fix two Playground code paths. #1172 changes the query behind the Runs list, and on a large PostgreSQL executions table the first start builds one more index.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: AbirAbbas Review duration: 34081m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1171"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%