Skip to content

aggregator(snapshot-records): skip Codex used_percent outside finite [0,100] #3460

Closed

Description

@dezren39

Follow-up to #2568.

recordsFromProviderUsage in pm-stack/aggregator/src/snapshot-records.ts:296-313 checks only typeof used_percent === "number" before emitting a pct record. The append CLI filters records through isSnapshotRecord (append-usage-snapshots.ts:71), whose current guard rejects negative pct values (snapshots.ts:317-323) but accepts finite values above 100. A real-module probe on main 199d9f2e222c17826533dc3d9320aebd88aab533 confirmed: -20 is emitted but rejected by the store; 150 and 1e9 are emitted and accepted; 42 is emitted and accepted. The original #2568 report that negative values pass the current store gate is stale, but the upper-bound defect remains.

Goal

Skip an invalid Codex window rather than clamp or invent a value, while continuing to derive the session record and any other valid window.

Acceptance

  • recordsFromProviderUsage emits a Codex window only when used_percent is finite and in the inclusive range [0,100].
  • snapshot-writers.test.ts covers negative and >100 values, plus valid boundary/control values; an invalid window does not suppress the other valid window or the sessions record.
  • Existing bun test test/snapshot-writers.test.ts passes.

Scope

Writer-side recordsFromProviderUsage and its focused tests only. Do not change the general store gate, other snapshot writers, or rollup validation (#3365). No clamping.

Acceptance criteria

  • Snapshot records whose Codex used_percent is NaN, infinite, or outside [0,100] are skipped (with the existing drop accounting, if any) instead of being recorded.
  • In-range values, including exactly 0 and exactly 100, are recorded unchanged.
  • Tests cover below-range, above-range, and non-finite inputs alongside an in-range control.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/queue-workerFiled or worked by the queue/worker pilot
    priority/lowNice to have; do when convenient
    on Nov 1, 2026
  2. developing-today commented on Nov 1, 2026

    @developing-today
    Contributor
  3. added
    effort/xsTrivial: expected under 30 minutes of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    status/triagedTriaged and routed (see agent note)
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  4. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · queued

  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: same drop-gate family as #2582 (shared [0,100] drop-gate pin, triage task 3837) and the charge-row gates in #3458 — worth the worker checking whether one shared guard now covers all three. No merged PR references this issue as of this run.

    Notes: the sibling triages pinned that out-of-shape rows must fail closed at the boundary rather than clamp — clamping a >100 reading to 100 would silently fabricate a full-quota signal. Risk: low.

    Suggested approach: apply the established finite-range guard at the snapshot-record boundary and mirror the sibling fix's test shape.

    🤖 Agent note · done

    • Agent: fleet monitor
    • Session / ID: repo-fleet-monitor run 2026-11-01T10:12Z
    • Found via: monitor reconciliation
    • Task: intake enrichment (protocol §5) — acceptance criteria appended, labels normalized, this review posted
    • Expectation: effort as labelled; done = acceptance criteria on the issue met by a fix PR
  6. added
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 1, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Picked up: OpenChamber scheduled lane claimed queue task 5391 via atomic claim.

    • Agent: repo-worker-code
    • Session / ID: ses_e5e652821cfffeHDR1E7h0X4dt
    • Task: Validate Codex used_percent bounds in recordsFromProviderUsage and focused snapshot-writer tests.
    • Next: Revalidate issue and PR ownership before creating a worktree or editing.
  8. 3 remaining items

  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Parked: Queue task 5391 is parked for 20 minutes while PR checks run.

  10. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientsource/queue-workerFiled or worked by the queue/worker pilottask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions