SIGN IN SIGN UP

fix: run work-metrics update on every transform pass

The initial work-metrics integration (commit fbfbc5a) gated the
computeOpenCodeWorkMetrics + setSessionWorkMetrics call on
workExecutedSuccessfully (OpenCode) and result.executedWorkThisPass (Pi).
That gate is overly conservative: the work-metrics update is a pure DB
read on the OpenCode message table plus a pure DB write to session_meta.
It does not mutate any tag state, does not rewrite message[0], and is
cache-stable.

Net effect of the bug: sessions sitting below the execute threshold
(default 65%) never see populated new_work_tokens / total_input_tokens
columns, so the TUI sidebar Stats section shows 0/0/0 for any session
that hasn't crossed threshold yet. For long-running but low-pressure
work this is essentially permanent.

Fix moves the work-metrics update out of the executedWorkSuccessfully
branch and runs it on every transform pass. Both OpenCode and Pi paths
updated symmetrically.

Verified:
- packages/plugin: typecheck clean, work-metrics.test.ts 6/6 pass
  (including live AFT smoke target)
- packages/pi-plugin: typecheck clean, work-metrics-pi.test.ts 1/1 pass
- Both dist bundles rebuilt
U
ualtinok committed
fc96631828c9d5bf5a39f7961bde0761bfe691b7
Parent: 3e4a147