Files
loki/scripts/test
CatoandClaude Opus 5 2d80b507ef fix(feedback): ask where a run ACTUALLY went, not where a new one would go (#792)
Risk 3 of the 2026-09-17 review: "Feedback attach-work falls back from
closed pending command to current project routing preference. A current
setting cannot prove where a historical attempt ran."

Exactly right. The channel resolution was:

  pending row (open) ?? pickDispatchChannel(project)

The open row is gone for most of a run's life — the runner stamps
executedAt on its inject-ack, within ~8s of injecting — so in practice
the second half decided almost every finished run. And that half is a
LIVE PREFERENCE. Flip a project from This computer to Cloud and every
finished local run starts claiming it ran on the box, with its offline
verdict computed against a machine it never touched.

The fix needed no new state, because the record already existed. The
executed pending_commands row carries the channel it was handed to, in
its payload, and getInjectAcksByRunIds was already reading exactly those
rows for the same runs — it just never selected the field. So the
immutable execution identity of the attempt was one property away the
whole time.

Now the order is an order of EVIDENCE:

  1. the open pending row  — this attempt, right now
  2. the executed command  — this attempt, recorded when it was handed
  3. the project's setting — where a NEW dispatch would go today

Only the first two are about the attempt being described. The third
stays as the last resort because a run that never reached a builder has
no recorded channel at all, and there the dispatcher's own rule is the
best available guess.

The channel lives in the jsonb payload rather than a column, so it is
validated the same way the open-row reader already validates it: an
unrecognised value is not a channel.

Tests: two cases — a project now set to Cloud whose attempt ran local
(the recorded fact wins, and the offline verdict follows it), and an
attempt with no recorded channel (falls back). Proved by mutation:
restoring the old expression fails "the recorded attempt outranks the
project's current preference". tsc clean, lint 0 errors, test:unit
204/204.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 09:34:52 -07:00
..
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00