Automations and webhooks for the AT Protocol airglow.run

fix(logs): keep runState when the delivery log refreshes from the automation API #56

Closed tyb.there-hugo.dev
Closed opened by tyb.there-hugo.dev

The automation page's Refresh button loses the "in progress" state of a suspended run. DeliveryLog's refreshLogs (app/islands/DeliveryLog.tsx) replaces the table with data.deliveryLogs from GET /api/automations/:rkey, but that route's serializer (app/routes/api/automations/[rkey].ts, the deliveryLogs: logs.map(...) block) leaves out runState, unlike the page render (app/routes/u/[handle]/[rkey]/logs.tsx) and GET /api/automations/:rkey/logs, which both send it.

How I know: I read the three serializers side by side while adding recordUri to each. After a refresh, a row parked at an AI step has runState undefined and statusCode null, so deliveryStatusText shows "-" instead of "In progress", LogStatusIcon shows a plain dot instead of the spinner, and the run header loses its " · in progress" suffix.

Where to start: add runState: l.runState to the deliveryLogs map in app/routes/api/automations/[rkey].ts, and add a route test that the field comes back.

Queued: the loop will work on this version of the issue.

loop:queued cid=bafyreifzcacjhi3tepp5ppr7kj2kpashjnxv6f2t7fikvbjmusasnbh53y

Working on this, attempt 1.

loop:claim run=contribute-20261026-155154-3myrxevjhl322 branch=loop/3myrxevjhl322 attempt=1 issue=56

fix(logs): keep runState when the delivery log refreshes from the automation API

GET /api/automations/:rkey now sends runState on each delivery log, as the page render and GET /api/automations/:rkey/logs already do. Before this, the delivery log's Refresh button swapped in rows with no runState, so a run parked at an AI step showed "-" instead of "In progress", a plain dot instead of the spinner, and no " · in progress" suffix on its header.

Verification #

  • New route test in app/routes/api/automations/[rkey].test.ts adds one resolved log and one in-progress log, then checks that the API returns runState as null and "in-progress". I ran it without the fix and it failed, then with the fix and it passed.
  • pnpm run check passes (format, lint, types).
  • pnpm run test passes (169 files, 2625 tests).

Acceptance criteria #

Decisions #

  • None to reverse. The field has the same name and shape ("in-progress" | null) as the other two serializers, and no migration was needed.

Review: https://tangled.org/exosphere.site/airglow/compare/main...loop/3myrxevjhl322

loop:pushed run=contribute-20261026-155154-3myrxevjhl322 sha=9724f43536cb957ef447d190f30c9613b8ce427a

Merge. The branch adds runState: l.runState to the deliveryLogs serializer in GET /api/automations/:rkey, so it now matches GET /api/automations/:rkey/logs and the page render. It also adds a route test showing the field comes back. Both acceptance criteria are met, and nothing outside the issue changed.

What I checked:

  • I read the diff: one line in the route and one new test. The field matches the island's DeliveryLog type ("in-progress" | null) and the other two serializers.
  • pnpm run check passes.
  • pnpm run test passes: 169 files, 2625 tests.
  • I took the route line out and ran the test again. The new test failed on the missing runState. With the line back, it passes.
  • There is no migration and no followup.

loop:verdict run=review-20261026-160026-3myrxevjhl322 sha=9724f43536cb957ef447d190f30c9613b8ce427a verdict=merge

Merged onto main as 1908205b70e39295dc53af321f38b8a8c733ef1a.

loop:merged sha=1908205b70e39295dc53af321f38b8a8c733ef1a head=9724f43536cb957ef447d190f30c9613b8ce427a

Sign up or Sign in to add to the discussion.