GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(cursor): limits show for a Cursor sign-in or CURSOR_API_KEY by olafura · Pull Request #1304 · hal-c2/hal-c2

Conversation

@olafura

@olafura olafura commented Nov 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The MC read Cursor usage limits only from a Cursor CLI login. A thread signed in with Sign in with Cursor, or running on a CURSOR_API_KEY, showed Cursor as signed in but with no limits (upstream pingdotgg/t3code#29419).

Fix

HalC2.ProviderUsageLimits.Acp now takes the API key from CURSOR_API_KEY or the instance's stored sign-in (an expired key, by the SDK credential file's apiKeyExpiresAtMs, is skipped; with no CLI login either, no limits show). It trades the key for a token at Cursor's default endpoint (POST /auth/exchange_user_api_key, the same exchange the Cursor SDK does) and reads GetCurrentPeriodUsage with that token. If the instance uses a custom API endpoint, the key is never sent: the limits say "Cursor usage for an API key requires the default Cursor endpoint." The CLI-login and CURSOR_AUTH_TOKEN paths are unchanged. docs/user/usage.md now describes this.

Scenarios out of the backlog (features/providers/cursor.feature, MC)

  • :264 "Cursor limits show for an account signed in with " (both rows: Sign in with Cursor, CURSOR_API_KEY). This is the limits half of the old outline.
  • :276 "Cursor limits for an API key are not read from a custom endpoint" (new, the endpoint guard from fix(cursor): show Cursor usage after signing in with Cursor pingdotgg/t3code#29419).

The history half of the old outline is now its own @backlog outline (:286). The MC has no Cursor usage history reader at all; that is #1305.

Left in the backlog, and why (maintainer decisions)

  • :211 "A handoff to Cursor is budgeted by the context window the model runs with". This assumes upstream's handoff budget, which defaulted Cursor to a 128K window. The MC's HalC2.Orchestration.Handoff caps every provider's transcript at a fixed 60,000 characters ("well inside any provider's context"), and no window enters into it. So the bug can't happen here, and the scenario has no MC equivalent unless we want window-scaled handoffs for every provider. Proposal: @dropped with that reason, or rewrite it as a cross-provider handoff scenario if we want scaling.
  • :728 (was :707) "What the Cursor SDK cannot do is refused with a reason". The three rows quote upstream's CursorAgentSdk refusals, and two of them are wrong about the MC. The MC rewinds Cursor threads (canRollbackThread; capabilities.feature lists only Grok and Muse Code as unable to rewind). It also forks them through a transcript; only a fork that must be native is refused, with "Cursor cannot fork this thread natively." For approvals, cursor-acp runs Cursor's own reviewer (autoReview), so no approval request ever reaches a client, and an answer has nothing to match. Proposal: @dropped, or keep only a "native fork is refused" row.
  • :303-:350 (were :283-:326), the @priority-low keychain group. Upstream fix(cursor): use the SDK account for usage data pingdotgg/t3code#32448 (merged 2026-11-07) removed the Cursor CLI-login and macOS keychain fallback for usage, along with its opt-in setting and prompts. Usage now comes only from the SDK sign-in or CURSOR_API_KEY, and CURSOR_AUTH_TOKEN still works for limits. So these six scenarios describe behaviour upstream has dropped. Two of them (fix(usage): hide the Cursor keychain prompt when Cursor isn't set up pingdotgg/t3code#13714, fix(clients): hide duplicate Cursor Keychain prompts pingdotgg/t3code#13870) were client-only changes anyway. Proposal: @dropped per fix(cursor): use the SDK account for usage data pingdotgg/t3code#32448. Separately, fix(cursor): use the SDK account for usage data pingdotgg/t3code#32448 also argues for dropping the MC's file-based CLI-login read, which "Cursor's monthly allowance is shown in the limits view" and "Cursor usage is unavailable with a keychain login" cover. I've left those alone for the upstream ledger pass to decide.

Also checked

  • feat(cursor): clear the Cursor backlog in the MC and cursor-acp #1284's last commit (subagent_call leaves a call the agent closed as never finished to end_turn_subagents). Through the slot runner: mix test acp_thread_runtime/native_subagent/acp_steer (9 passed), mix features providers/opencode (81), acp-registry (136), grok (23) and cursor (115), all green.
  • A mid-turn _meta.interrupted can't happen: cursor-acp emits it only from finish, which runs once after run.wait() and directly before the prompt reply that ends the turn. So no guard was added.

Verification

  • mix features providers/cursor.feature: 118 passed. providers/usage-limits.feature: 50 passed.
  • mix format --check-formatted, MIX_ENV=test mix compile --warnings-as-errors, mix sobelow.check (no new findings).

Stacked on #1284; I'll retarget it to main once #1284 merges.

Made by Claude Opus 5.5 in Claude Code, running in HAL-C2.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@olafura @claude
feat(cursor): limits show for a Cursor sign-in or CURSOR_API_KEY
68db69c
The MC read Cursor usage only from a Cursor CLI login, so a thread signed
in with "Sign in with Cursor" or a CURSOR_API_KEY showed no limits. The
key is now traded for a token at Cursor's default endpoint, as the Cursor
SDK does, and the usage read with it. A custom endpoint never receives the
key. Cursor usage history stays in the backlog: the MC has no Cursor
history reader yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@olafura olafura mentioned this pull request Nov 8, 2026
MC: read Cursor usage history from the Cursor account #1305
Open
olafura and others added 3 commits November 8, 2026 08:51
@olafura
Merge remote-tracking branch 'origin/backlog/providers-cursor' into b…
8c77cec
…acklog/providers-cursor-2
@olafura @claude
test(mc): pin workspace entry mtimes so the browse order is fixed
26986ea
The empty-query browse sorts entries by mtime, and setup wrote src/deep
after src, so crossing a second boundary during setup could flip the
expected order. Pin the directory mtimes at the end of setup.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
@olafura
Merge branch 'backlog/providers-cursor' into backlog/providers-cursor-2
1c9dcc4
@olafura
olafura marked this pull request as ready for review November 8, 2026 10:25
olafura
olafura commented Nov 8, 2026
View reviewed changes

@olafura olafura left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approved

1 finding: 1 medium.

Cursor limits now come from CURSOR_API_KEY or the instance's stored sign-in. The key is traded for a token at the default endpoint, and a custom endpoint is refused before the key is sent anywhere. That matches the description. The credential order also matches cursor-acp, where CURSOR_API_KEY replaces the stored sign-in, so limits describe the account the agent actually runs on. The biggest risk is the expired-key skip. Nothing in this repo writes apiKeyExpiresAtMs, and no scenario covers it, so it could be dead code or read the wrong field name. Also, the workspace_test.exs mtime pin has nothing to do with Cursor limits. It belongs in its own PR ("one concern per PR").

Not run

  • Confirm the Cursor SDK's credential field names: node_modules is not installed here, and installing would need network access

Blocked on the reviewing machine (a setup problem there, not in this change)

  • mix features providers/cursor.feature providers/usage-limits.feature: ** (Mix) Can't continue due to errors on dependencies: Hex deps not fetched (needs mix deps.get with network)
Ran 4 checks
  • git diff e08f27d28 HEAD (lib, tests, feature, docs): Read the whole change, plus HalC2.Acp.command/2 (where HAL_C2_CURSOR_CREDENTIALS comes from), cursor_credentials/1 and the http/4 helper
  • grep across the repo for CURSOR_API_KEY / HAL_C2_CURSOR_CREDENTIALS in packages/cursor-acp: The agent prefers CURSOR_API_KEY over the stored sign-in, and the limits code uses the same order
  • grep -r apiKeyExpiresAtMs: The only hit is the new reader; nothing in the repo writes the field
  • mise exec -- mix features providers/cursor.feature providers/usage-limits.feature: Did not run: the Hex deps are not fetched in this checkout ("the dependency is not available, run mix deps.get")

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/server-ex/lib/hal_c2/provider_usage_limits/acp.ex Resolved

Uh oh!

There was an error while loading. Please reload this page.

@olafura
Merge remote-tracking branch 'origin/backlog/providers-cursor' into b…
4f8c1a5
…acklog/providers-cursor-2
olafura
olafura commented Nov 8, 2026
View reviewed changes

@olafura olafura left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approved

No findings.

Cursor limits now come from the instance's Cursor sign-in or CURSOR_API_KEY: the key is traded for a token at the default endpoint, and it is never sent to a custom endpoint. Nothing in the PR's own files changed since my last review at 1c9dcc4. The new commits only merge origin/main and backlog/providers-cursor (the Claude provider work from #1302), and the PR diff against its base is identical. My earlier finding is still open with the code unchanged, so I'm not raising it again. That finding is that no scenario covers the expired-key skip, and that nothing in the repo writes apiKeyExpiresAtMs. It remains the main risk: if the SDK names that field differently, an expired key is exchanged anyway and shows as probeFailed, not as unavailable.

Not run

  • mix features providers/cursor.feature: The PR's code is unchanged since the last review. The new commits are base merges that the base branch's own review and CI cover.
Ran 2 checks
  • git diff --stat 1c9dcc4e..HEAD -- acp.ex, cursor_steps.exs, cursor.feature, usage.md, workspace_test.exs: Empty: the PR's files are unchanged since the last review.
  • git diff 473ebdd9..HEAD -- apps/server-ex/lib/hal_c2/provider_usage_limits/acp.ex: Same change as reviewed before.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@olafura @claude
test(mc): Cursor limits skip a stored sign-in whose key has expired
b29aeda
apiKeyExpiresAtMs is a real field of the Cursor SDK's StoredSdkCredentials
(@cursor/sdk auth/credential-store.d.ts). Add the scenario for the fallback.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
olafura
olafura commented Nov 8, 2026
View reviewed changes

@olafura olafura left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approved

No findings.

The new commit adds an MC scenario for a stored Cursor sign-in whose apiKeyExpiresAtMs is in the past. The scenario checks that no limits show and that the key never reaches the fake HTTP endpoint, which covers the expiry guard in cursor_api_key (acp.ex:187-197). The previous review approved with no findings, so nothing was outstanding. This commit only adds a test and is correct as read. The one remaining risk is that this machine could not run it.

Blocked on the reviewing machine (a setup problem there, not in this change)

  • mise exec -- mix features providers/cursor.feature: Mix stops on missing Hex deps in this checkout (sobelow, tz, ...): "the dependency is not available, run mix deps.get". I did not fetch them because that needs network access.
Ran 2 checks
  • git diff 4f8c1a53f HEAD: 34 added lines: one scenario in features/providers/cursor.feature and three step definitions in cursor_steps.exs
  • sed -n 180,200p lib/hal_c2/provider_usage_limits/acp.ex: The expiry guard returns nil when expiresAtMs is a number at or before now. With no CLI login, the code then falls through to unavailable "unsupported", which is what the new step asserts.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@olafura
Merge remote-tracking branch 'origin/backlog/providers-cursor' into b…
c7709b8
…acklog/providers-cursor-2
olafura
olafura commented Nov 8, 2026
View reviewed changes

@olafura olafura left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approved

No findings.

Cursor limits are now read for a stored Cursor sign-in or CURSOR_API_KEY: the key is exchanged at the default endpoint, an expired key is skipped, and a custom endpoint gets a refusal instead of the key. Since my last review (b29aeda, approved, no findings) the only new commit is c7709b8, a merge of the base branch. It leaves the PR's own files (provider_usage_limits/acp.ex, cursor_steps.exs, cursor.feature, usage.md, workspace_test.exs) exactly as I approved them. What it brings in is base-branch work and is not part of this PR's diff. The approval stands. The biggest remaining risk is the same as before: the token exchange is checked only against the fake endpoint in the step tests, never against real Cursor.

Blocked on the reviewing machine (a setup problem there, not in this change)

  • mix features providers/cursor.feature and providers/usage-limits.feature on the merged HEAD: ** (Mix) Can't continue due to errors on dependencies ("the dependency is not available, run mix deps.get"). I did not fetch deps because that needs network access the review did not call for.
Ran 2 checks
  • git diff b29aeda1b HEAD --stat, and git diff 5f2d83fd2 HEAD --stat: None of the PR's own files changed since the last review. The new commit is a merge of the base branch.
  • mise exec -- mix features providers/cursor.feature: Did not run: the Hex deps (sobelow, tz, …) are not installed in this checkout.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@olafura
olafura merged commit d75a099 into backlog/providers-cursor Nov 8, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@olafura
olafura deleted the backlog/providers-cursor-2 branch November 8, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@olafura
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.