Skip to content

Coordinate aggregate recording for hook invocations - #330

Open
gmemuriuki wants to merge 2 commits into
telemetry/staged-aggregate-statefrom
telemetry/aggregate-recording-coordinator
Open

gmemuriuki wants to merge 2 commits into
telemetry/staged-aggregate-statefrom
telemetry/aggregate-recording-coordinator

Conversation

@gmemuriuki

@gmemuriuki gmemuriuki commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR coordinates aggregate recording for one complete hook invocation.

One input carries the hook result, every plugin attempt, and an optional skill observation. The hook row's plugin totals are derived from that collection, so claimed counters cannot disagree with the plugin attempts supplied to the coordinator.

The coordinator owns the metric snapshot, opens all three private stages, checks snapshot-day ownership, and applies hook, terminal plugin-hook, and optional extension-invocation rows as one staged unit. Any selection or row-update failure discards the snapshot and all three private stages. Success returns an unpublished value for the later persistence transaction.

Tests cover non-terminal plugin attempts, mid-loop plugin failure, later-family failure, cross-family event_id mismatch, rollover, recovery, repeated plugin buckets, and the complete three-family success path.

Disclosure questions

AI disclosure.

  • The AI tool authored large parts of the code

Questions for reviewers.

Does the invocation input make plugin-count disagreement unrepresentable, and is the all-or-none in-memory staging guarantee clear without reading as a durability promise?

@gmemuriuki gmemuriuki self-assigned this Oct 8, 2026
@gmemuriuki
gmemuriuki added this pull request to stack #331 October 8, 2026 18:34
@gmemuriuki
gmemuriuki force-pushed the telemetry/aggregate-recording-coordinator branch 2 times, most recently from 607e9c4 to 73cf76e Compare October 14, 2026 07:51
@nikomatsakis
nikomatsakis force-pushed the telemetry/aggregate-recording-coordinator branch from 73cf76e to 12e8ffe Compare October 16, 2026 09:02
@gmemuriuki
gmemuriuki force-pushed the telemetry/aggregate-recording-coordinator branch from 12e8ffe to f88e0f3 Compare October 20, 2026 13:23
Define one invocation-scoped input that carries the hook result, each
plugin attempt, and an optional skill signal. Derive plugin totals from
that collection so callers cannot supply counters that disagree with
the rows staged later.

Validate the consent-version-one extension agent and hook-to-phase
mapping before private aggregate state is opened. Add shared aggregate
family vocabulary and wire-label formatting for typed diagnostics.

Keep the coordinator dependency explicit with temporary dead-code
expectations that the next commit removes.
Stage hook, plugin-hook, and optional extension-invocation rows from
one normalized input. Derive plugin totals from that input, edit an
owned metric snapshot, and keep copy-on-write private stages for all
three families alive together.

Check snapshot day ownership before opening private stages, propagate
every selection and row error, and preflight poisoned stages before
the three infallible commits. Failures discard the complete staged
unit; success returns an unpublished token for persistence.

Add coverage for mid-loop plugin rollback, later-family failure,
recovery, rollover, repeated buckets, and the three-family success
path. Update the recording contract and module map with the new
atomicity boundary.
@gmemuriuki
gmemuriuki force-pushed the telemetry/aggregate-recording-coordinator branch from f88e0f3 to e16e922 Compare October 20, 2026 13:26

This branch has not been deployed

No deployments
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