Skip to content

fix(quota-plane): lapsed OpenCode Go workspace renders as lapsed, not error (#1161) - #7898

Merged
dezren39 merged 6 commits into
mainfrom
queue/12991-1161-lapsed
Nov 10, 2026
Merged

dezren39 merged 6 commits into
mainfrom
queue/12991-1161-lapsed

Conversation

@dezren39

@dezren39 dezren39 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Task 12991 / issue #1161. A configured opencode-go result carrying the OpenCode Go no-active-subscription signal maps to lapsed, propagates to its workspace pool, and survives quota ingest as a terminal non-error state with no stale percentages presented as current. Lapsed-only runs bypass failed-read retention; mixed runs preserve lapsed workspaces while retaining unaffected failed siblings.

Verification on head 9b4b6b85692ae6df21395528e87821cecd154667: bun test test/quota-gather-map.test.ts test/quota-current.test.ts test/gather-quota.test.ts test/digest.test.ts test/feed.test.ts test/credential-lifecycle.test.ts — 210 passed, 0 failed. GitHub checks are pending.

repo-worker-code-k added 2 commits November 8, 2026 18:32
…error (#1161)

A configured opencode-go result carrying 'No active OpenCode Go
subscription' now maps to entry state lapsed, propagates through
pool splits, survives ingest validation, and renders as a terminal
non-error lapse with no stale percentages.
…n errors (#1161)

Follow-up hardening on the lapsed-state fix: entryFromResult returns
lapsed entries windowless (old usage alongside the lapse signal stays
evidence on entry.usage, never a fresh window), and finalizeRun treats
only error runs as retention candidates so a mixed ok/error/lapsed
provider can never be misreported as lapsed.
@dezren39
dezren39 requested a review from a team as a code owner November 9, 2026 01:16
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7b738ee2-bfaa-4da6-a9e7-d321da51afad
Commits

Reviewing files that changed from the base of the PR and between 2867299 and 912d172.

Files selected for processing: 13

  • pm-stack/aggregator/scripts/gather-quota.ts
  • pm-stack/aggregator/src/assets/app.css
  • pm-stack/aggregator/src/credential-lifecycle.ts
  • pm-stack/aggregator/src/digest.ts
  • pm-stack/aggregator/src/feed.ts
  • pm-stack/aggregator/src/model.ts
  • pm-stack/aggregator/src/notifications.ts
  • pm-stack/aggregator/src/quota-current.ts
  • pm-stack/aggregator/src/quota-gather-map.ts
  • pm-stack/aggregator/src/quota-refresh.ts
  • pm-stack/aggregator/test/gather-quota.test.ts
  • pm-stack/aggregator/test/quota-current.test.ts
  • pm-stack/aggregator/test/quota-gather-map.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T21:19:24.979479Z
We couldn’t complete this review. Comment @codex review to try again.
912d172 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a70a475ce5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 requested a balanced review from Copilot November 9, 2026 01:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b4b6b8569

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +233 to +235
pool.windows = [];
delete pool.wallLiftsAt;
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh model-choice guidance when clearing lapsed windows

When a lapse is applied and no other entry supplies fresh percentage windows, this branch clears the pool's windows but returns false, leaving anyFreshWindows unset. Consequently, overlayQuotaCurrent() preserves the base view's choices, potentially still recommending the cancelled workspace under “Headroom for a new session” or “Burn-it-before-reset.” The filtering in feed.ts happens before the overlay in sources/live.ts, and render.ts displays these choice lists directly. Invalidate or recompute guidance when a lapse removes a pool's usable windows, even without a successful sibling read.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e572e55 ("invalidate choices for lapsed pools"): when a lapse is applied, applyEntry's lapsed branch clears the pool's windows and returns true, and both overlay call sites now capture that return so computeChoices runs again — a lapsed pool no longer keeps stale model-choice guidance. Verified again in the 2026-11-10 shepherd merge of current main into this branch (conflict resolution kept both the legError plumbing and the choices-recompute capture at both call sites); aggregator quota suites green.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Updates quota ingestion/overlay/rendering to treat OpenCode Go “No active subscription” as a terminal lapsed state (not an error), ensuring lapsed workspaces split correctly and do not publish stale quota windows or trigger retention.

Changes:

  • Map OpenCode Go “no active subscription” failures to a new lapsed state and propagate it through split mapping, ingest validation, overlay, notifications, digest, and credential lifecycle.
  • Clear windows / suppress snapshot emission and guidance for lapsed pools to avoid presenting stale percentages as current.
  • Add/adjust tests to cover mapping, retention behavior, and overlay effects for lapsed runs.
File Description
pm-stack/​aggregator/​src/​quota-gather-map.ts Introduces lapsed mapping for OpenCode Go lapse signal and prevents publishing windows on lapse.
pm-stack/​aggregator/​scripts/​gather-quota.ts Updates run finalization/retention logic so lapsed rows aren’t replaced by last-known OK data.
pm-stack/​aggregator/​src/​quota-current.ts Adds lapsed handling in overlay (clears windows, recomputes choices) and ingest validation.
pm-stack/​aggregator/​src/​model.ts Extends shared types (QuotaState, freshness states, heartbeat states, etc.) to include lapsed.
pm-stack/​aggregator/​src/​notifications.ts Prevents notifications/wall derivation for lapsed pools.
pm-stack/​aggregator/​src/​digest.ts Adds lapsed messaging in per-pool notes (but degraded-provider summary logic remains error/stale only).
pm-stack/​aggregator/​src/​feed.ts Updates runtime validators to accept lapsed states.
pm-stack/​aggregator/​src/​credential-lifecycle.ts Adds lapsed as a credential lifecycle classification.
pm-stack/​aggregator/​src/​quota-refresh.ts Treats lapsed as a non-error freshness state when computing newest measurement time.
pm-stack/​aggregator/​src/​assets/​app.css Adds styling for a lapsed badge.
pm-stack/​aggregator/​test/​quota-gather-map.test.ts Updates/extends split behavior assertions for lapsed vs error and window suppression.
pm-stack/​aggregator/​test/​quota-current.test.ts Adds overlay test ensuring lapse is terminal, clears windows, and removes guidance.
pm-stack/​aggregator/​test/​gather-quota.test.ts Adds end-to-end retention/ingest tests ensuring lapsed survives and doesn’t emit snapshots.

Review effort: Lite

.filter(
(p) =>
(p.freshness?.state ?? p.state) === "error" ||
(p.freshness?.state ?? p.state) === "stale",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional, not an omission: the digest's degradedProviders list is the error/stale set — providers whose reads are failing or aging. A lapsed pool is a terminal, successfully-read state (the subscription ended; the read worked), so it surfaces through its pool state and the explicit lapsed pool note rather than the degraded list, the same way it is not counted in the renderer's error-pool count. Keeping it out of "degraded" is what makes the lapsed state distinct from error, which is the point of this PR.

Comment on lines +405 to +413
export function isGoLapseResult(result: QuotaProviderResult): boolean {
return (
result.providerId === "opencode-go" &&
!result.ok &&
result.configured &&
typeof result.error === "string" &&
result.error.includes("No active OpenCode Go subscription")
);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the 2026-11-10 shepherd push (912d172): isGoLapseResult now compares canonicalProviderId(result.providerId) to "opencode-go", matching entryFromResult's canonicalization.

repo-worker-code-k added 2 commits November 10, 2026 15:19
# Conflicts:
#	pm-stack/aggregator/src/quota-current.ts
… newestMeasurement docstring (Copilot review, PR #7898)
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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.

2 participants