Skip to content

Quota refresh: newestMeasurement counts the terminal "lapsed" state against its own contract (PR #7898 review finding) #8125

Closed

Description

@dezren39

Quota refresh: newestMeasurement counts the terminal "lapsed" state against its own contract (PR #7898 review finding)

Finding (from PR review)

On PR #7898 (fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161)), Copilot review comment 4508796654 (Copilot, 2026-11-09T01:59:26Z, pm-stack/aggregator/src/quota-refresh.ts:36):

The docstring says "Newest non-error provider/pool measurement", but the helper now treats "lapsed" as eligible (i.e., it's not filtered like "error"). Since "lapsed" is a terminal non-measurement state (windows cleared), counting it as a "measurement" could be misleading for consumers of newestMeasurement (e.g., if it's used to decide whether the view is stale and should auto-refresh). Recommendation: either (a) explicitly exclude "lapsed" here, or (b) update the function comment (and any related naming/usage) to reflect that terminal states can advance the "newest" timestamp.

No-response evidence

  • No replies in the comment thread; the review thread is unresolved (GraphQL reviewThreads verified 2026-11-10 by this run: the thread containing comment 4508796654 has isResolved: false).
  • PR fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) #7898 head is unchanged at e572e55ce340e79f4d49cad0f4aebd7fea55dc7d since the comment (last commit 2026-11-09T01:54:23Z, before the comment); no fix commit followed it. The finding is past the 24-hour grace period for open PRs (comment 2026-11-09T01:59:26Z).
  • Issue search (open and closed) by PR number, file path, and keywords (newestMeasurement lapsed, lapsed quota-refresh, 7898) found no existing issue covering this finding.

Still-live evidence (current PR head)

Raw read at head e572e55ce3 agrees:

  • pm-stack/aggregator/src/quota-refresh.ts:32: docstring "Newest non-error provider/pool measurement in the view".
  • Lines 35-36: the add() helper's state type includes "lapsed" and it returns early only for "error" — a lapsed pool/credential/provider timestamp therefore advances the newest-measurement value.
  • isQuotaStale() (same file) decides staleness/auto-refresh off newestMeasurement(), so a terminal lapse timestamp can make a view with no fresh measurements read as not stale.

Acceptance criteria

  • Either newestMeasurement() explicitly excludes the "lapsed" state, or the docstring/naming is updated to state that terminal states advance the newest timestamp AND that choice is pinned by a test — so the helper's contract and isQuotaStale()'s refresh decision are unambiguous.
  • Resolving by a documented decision on this issue is also acceptable.

Filed by the pr-comment-review job (run 2026-11-09 23:54 CST) under the queue cutover: labels applied at filing, standard agent note posted after filing, and a repo-task/v1 triage packet (kind: triage, priority 30) enqueued on repo-health-code-pilot.

Activity

  1. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    on Nov 10, 2026
  2. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/sSmall: expected under 2 hours of work
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 10, 2026
  5. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged
    • Work kind: task/small-fix
    • Priority: priority/normal — Brief line 5: everything else by usefulness. An ordinary correctness fix in quota refresh/staleness (already priority/normal on the issue).
    • Effort: effort/s
    • First step: In pm-stack/aggregator/src/quota-refresh.ts, exclude 'lapsed' in the add() helper (:35-36) like 'error', or re-document the contract, and add the lapsed-only staleness test.
    • Acceptance check: Either newestMeasurement() explicitly excludes 'lapsed', or the docstring/naming states terminal states advance the newest timestamp AND a test pins that choice; isQuotaStale() for a lapsed-only view matches the chosen contract.
    • Packet: Fix packet: task 14587 in repo-health-code-pilot (dedupe repo-health:v1:fix:developing-today/code:issue:8125).
  6. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    and removed on Nov 10, 2026
  8. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  9. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    lane: code-d
    task: 14587
    issue: #8125
    stage: handed_off
    note: Task 14587 (small_fix, issue #8125) revalidated fresh by lane code-d: issue OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit absent), no status/needs-triage. Execution lane row 5785 = opencode; handed off per 1b Rule 4 (scheduled shift is time-bounded; claimant is the persistent execution session). Attempts 2/4. Parked 1200s for claimant pickup.

  10. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    lane: code-d
    task: 14587
    issue: #8125
    stage: handed_off
    note: Task 14587 (small_fix, issue #8125) revalidated fresh by lane code-d: issue OPEN, labels kind/bug, task/small-fix, priority/normal; no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit absent), no status/needs-triage. Execution lane row 5785 = opencode; handed off per runbook 1b Rule 4 (scheduled shift is time-bounded; claimant is the persistent execution session). Attempts 2/4. Parked 1200s for claimant pickup.

  11. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    agent-note: task 14587 handed off to opencode claimant (lane row 5785) by lane code-w. Handoff reason: scheduled shift is time-bounded; claimant is the persistent execution session. Issue #8125 verified OPEN with no hard-stop labels and no status/needs-triage (fresh gh, lane code-w 2026-11-10). Attempts 3/4. Parked 1200s for the claimant.

  12. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Transition: picked up
    Worker: repo-worker-code / OpenChamber lane 02cafe76-eafd-4d0b-aaa6-2b7a737d68dc
    Task: 14587
    Next: Revalidate prior assignment 5785 and avoid competing work.

  13. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Transition: parked
    Worker: repo-worker-code / OpenChamber lane 02cafe76-eafd-4d0b-aaa6-2b7a737d68dc
    Task: 14587
    Reason: Existing OpenCode execution assignment 5785 remains unresolved. Verify whether that claimant is active before starting competing work; retry after 30 minutes.

  14. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — already_done (contract re-documented in PR #7898 itself)

    • Agent: repo queue worker, lane code-k (repo-worker-code), task 14587. Assignment: direct.
    • Fresh verification at current main: the Copilot finding offered (a) exclude lapsed from newestMeasurement, or (b) re-document the contract. (b) was taken, in PR fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) #7898 itself: commit 912d172 ("fix(quota-plane): canonicalize provider id in Go lapse check; clarify newestMeasurement docstring (Copilot review, PR fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) #7898)", 2026-11-10) changed the docstring at pm-stack/aggregator/src/quota-refresh.ts:32 from "Newest non-error provider/pool measurement" to "Newest provider/pool measurement stamp in the view, in epoch ms, or null. Error reads are excluded; a lapsed read contributes its stamp (it is a current terminal state, not a measurement of usage)." PR fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) #7898 merged 2026-11-10T21:21:06Z with that commit in it. This issue was filed from the finding earlier the same day, before the fix commit landed — the packet/title itself names the re-document option as an acceptable resolution.
    • Why (b) is the right contract: a lapsed read is terminal and current; counting its stamp means isQuotaStale does not spin auto-refresh against a state refresh cannot change. Code and docstring now agree.
    • Thread hygiene completed by this lane: replied on the PR fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) #7898 review thread (comment 4508796654) with this disposition and resolved the thread (verified isResolved: true) — it had stayed unresolved in the UI despite the fix being merged.
    • Action: closing this issue as already-done with the evidence above; task 14587 completes as already_done. No code change needed.
  15. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/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