Skip to content

fix(telemetry): a turn end is a pause for a flow too - #763

Merged
blafourcade merged 1 commit into
nextfrom
fix/a-turn-end-is-a-pause-for-a-flow-too
Sep 4, 2026
Merged

blafourcade merged 1 commit into
nextfrom
fix/a-turn-end-is-a-pause-for-a-flow-too

Conversation

@blafourcade

@blafourcade blafourcade commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What

buildFlowIntervals closed a flow at the first turn_end after it opened. The task axis stopped doing exactly that on 2026-09-04 — "a turn_end is a pause, not a change of subject" (task-attribution.ts:28) — and the flow axis never followed.

It is the axis where the error is largest. On this machine's sink, period 2026-08-01..2026-09-04:

Axis What it named for aidd-orchestrator:01-sdlc
by_step 2,220 requests
by_flow 56 requests

A flow is the wider concept — the orchestration and everything it drove — yet it named 40× fewer requests than the step inside it. The journal shows why: the flow opened at 05:56:27, the first turn_end closed it at 06:02:34, and the same session went on writing into the same task folder until 09:27:21.

Change

A flow closes on a step_end naming its own skill, or on the next orchestrating step_start. The same rule buildStepIntervals adopted when step_end was introduced; a step_end naming a different skill never closes a flow it has no claim on.

buildClosedIntervals gains an opener-aware isCloser — "a step_end naming this flow's skill" is a fact about the pair, which a pre-filtered closer list cannot express. The walk becomes a forward scan from each opener and answers identically for an opener-independent closer, which is what buildTaskIntervals passes.

cost_report_version stays 15: no field changes shape or vocabulary, and the task axis changed its own closer under the same rule without a bump.

Proof

Both binaries run back to back, same sink, same instant:

version period total by_flow sdlc by_flow unnamed
origin/next 15 30,222 56 30,166
this branch 15 30,222 1,052 29,170

All eleven breakdowns sum to 30,222 on both runs, and ten of the eleven are byte-identical between the two reports — the change moved the axis it names and nothing else.

Mutation Killed
turn_end back in the closer the pause guards (3)
no closer at all the step_end guards (2)
close on any step_end the other-skill guard (1)
an opener no longer closes the one before it 1 flow guard, 2 task guards
unclosed ends at its own start 19 across both axes
the scan starts at the opener itself 23 across both axes

The residue this does not close

After the fix the flow still names fewer requests than the step inside it — 1,052 against 2,220 — and the reason is not the closer. A StepInterval is deliberately left open (POSITIVE_INFINITY), so about 1,168 of the step's requests fall after the journal stopped witnessing anything. That is a separate defect with its own reasoned defence at step-attribution.ts:37-52, tied to telemetry check's records-join claim; it is filed in the plan, not touched here.

Cost, stated

Only aidd-dev:01-plan emits aidd:step-end today, so a flow still usually closes on the next orchestrating step_start or the journal's own last witnessed moment. Making the three orchestrators emit the marker is a separate change in the plugin tree.

The axis also gained the end-to-end guard it lacked: telemetry-flow-axis.e2e.test.ts passed unchanged through this diff because its fixture ended on a turn_end with nothing witnessed after it — the coincidence class the unit fixtures were rewritten to escape. One record at 09:55, between the pause and the next opener, now separates the two rules, and putting turn_end back turns three of its five cases red.

Gates: 3416 tests / 306 files, tsc, biome ci, knip, jscpd, bundle within budget, 368 repository script tests, 0 broken links, cli layering clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp

@blafourcade
blafourcade requested a review from a team as a code owner September 4, 2026 21:19
buildFlowIntervals closed a flow at the first turn_end after it opened. The
task axis stopped doing exactly that on 2026-09-04 - "a turn_end is a pause,
not a change of subject" - and the flow axis never followed, though it is
where the error is largest: on the one orchestrated session in this machine's
sink, the flow opened at 05:56:27, the first pause fell at 06:02:34, and the
same orchestration went on writing into the same task folder until 09:27:21.
The step axis named 2,220 requests for that skill while the flow, the wider
concept, named 56.

A flow now closes on a step_end naming its own skill, or on the next
orchestrating step_start - the same rule buildStepIntervals adopted when
step_end was introduced. A step_end naming another skill never closes a flow
it has no claim on.

buildClosedIntervals gains an opener-aware isCloser, which cannot be expressed
otherwise: "a step_end naming this flow's skill" is a fact about the pair. The
walk becomes a forward scan from each opener and answers exactly as before for
an opener-independent closer, which is what buildTaskIntervals passes.

Measured back to back against the same sink: by_flow 56 -> 1052 for
aidd-orchestrator:01-sdlc, every breakdown still summing to 30,222, and ten of
the eleven breakdowns byte-identical between the two reports.

cost_report_version stays 15: no field changes shape or vocabulary.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
@blafourcade
blafourcade force-pushed the fix/a-turn-end-is-a-pause-for-a-flow-too branch from 73a7c96 to 5d3dd77 Compare September 4, 2026 21:23
@blafourcade
blafourcade merged commit ae70de6 into next Sep 4, 2026
24 of 26 checks passed
@blafourcade
blafourcade deleted the fix/a-turn-end-is-a-pause-for-a-flow-too branch September 6, 2026 06:22
@aidd-bot aidd-bot Bot mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant