Skip to content

fix(aggregator): surface expiring quota actions on Today and Needs You - #4695

Open
dezren39 wants to merge 2 commits into
mainfrom
queue/6560-1174-quota-actions
Open

dezren39 wants to merge 2 commits into
mainfrom
queue/6560-1174-quota-actions

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

quota source facts + usage state
  -> derive eligible quota actions once
  -> /quota attention strip
  -> /today actionable objectives
  -> /attention orchestrator tier

Adds typed deadline/action facts (including cancelled OpenCode Go Personal/Lab), and derives expiring, walled/billing, and high-usage actions without parsing display prose.

Evidence

Merge Danger

Door: two-way

Blast Radius: narrow — aggregator quota actions and their three render surfaces.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

#1174)

Typed QuotaAction derivation (buildQuotaActions): cancelled-period
expiry within 14 days from the plan-facts registry, walled pools,
and >85% windows with reset >24h out. Same entries render on
/quota's attention strip (via usage.attention), /today (alerts +
objectives), and /attention's orchestrator tier (task items).
Entries exist only while their condition holds.
@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 01:04
@coderabbitai

coderabbitai Bot commented Nov 3, 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 29 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: 0a6db48b-8655-4da0-9341-d683c1893417
Commits

Reviewing files that changed from the base of the PR and between 9dfc29e and 39c62cb.

Files selected for processing: 9
  • pm-stack/aggregator/src/aa.ts
  • pm-stack/aggregator/src/derive.ts
  • pm-stack/aggregator/src/model.ts
  • pm-stack/aggregator/src/render.ts
  • pm-stack/aggregator/src/server.ts
  • pm-stack/aggregator/src/sources/fixtures.ts
  • pm-stack/aggregator/src/sources/live.ts
  • pm-stack/aggregator/test/quota-actions-1174.test.ts
  • pm-stack/aggregator/test/quota-contract.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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T01:07:37.772318Z 39c62cb PR opened
ℹ️ 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: 39c62cbf46

ℹ️ 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 +979 to +983
for (const w of pool.windows) {
const pct = windowPercent(w);
if (pct > worstPct) {
worstPct = pct;
worst = w;

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 Check reset eligibility before selecting the highest-usage window

For a pool with multiple windows, a higher-percentage short window can mask a qualifying longer window. For example, a 5-hour window at 99% resetting in two hours and a weekly window at 92% resetting in four days produce no action: the loop selects the 5-hour window, then rejects its reset without considering the weekly window. The same happens when the highest window has no reset recorded, a shape produced by extractClinePass in quota-extract.ts. Filter for valid, distant resets before selecting the highest percentage so qualifying warnings remain visible.

Useful? React with 👍 / 👎.

attention: [...buildAttentionFlags(feed.quota, partial), ...feedChargeFlags],
attention: [
...buildAttentionFlags(feed.quota, partial),
...quotaActionFlags(buildQuotaActions(feed.quota, AA_PLAN_FACTS)),

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 Derive quota-strip actions from the overlaid quota view

When quota-current.json contains a fresh gatherer reading, source.quota() applies overlayQuotaCurrent, which replaces windows and recomputes pool state, but this path derives the new actions from the unoverlaid feed.quota. Consequently, a formerly walled pool that the gatherer now reports as healthy still displays a walled action on /quota, while Today and Needs You correctly clear it; newly high usage can likewise be missing from the strip. Derive these actions from the same overlaid quota view used by the other surfaces, including in the direct-read fallback.

Useful? React with 👍 / 👎.

Comment on lines +445 to +448
view.orchestratorExtra = [
...view.orchestratorExtra,
...quotaActionTierItems(buildQuotaActions(quota, AA_PLAN_FACTS)),
];

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 Include synthesized quota tasks in the attention API

Whenever an eligible quota action exists, adding its task only to orchestratorExtra makes it visible in the HTML queue but absent from /api/attention.json: that handler serializes only view.all and view.watchdog, neither of which receives these tasks. The page explicitly advertises that endpoint as its machine-first interface, so machine consumers cannot discover or act on the new quota tasks despite their appearance in Needs Orchestrator. Include the synthesized tasks in the API response with the corresponding tier annotation.

Useful? React with 👍 / 👎.

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