Skip to content

Add Venice web quota strategy - #3474

Open
audreyt wants to merge 6 commits into
steipete:mainfrom
audreyt:feat/venice-web-quota
Open

Add Venice web quota strategy#3474
audreyt wants to merge 6 commits into
steipete:mainfrom
audreyt:feat/venice-web-quota

Conversation

@audreyt

@audreyt audreyt commented Sep 7, 2026

Copy link
Copy Markdown

Cookie-based Venice subscription quota via the signed-in venice.ai session (monthly refill windows from the session JWT), as an explicit-web-only venice.web strategy.

Never runs in automatic mode, so no surprise browser-cookie prompts. Auto/API behavior unchanged.

Review follow-ups addressed (round 2):

  • Selected token accounts route to the API script via the credential adapter, so ambient browser sessions are never fetched or mislabeled as a saved account (covered).
  • Preferences detail shows the live source label instead of hardcoded api.
  • Token-account scoping: the strategy is unavailable and refuses before any cookie import when an account is selected (covered).
  • Session fallback: iterates imported profiles, continuing past session-auth failures (covered).
  • Linux: auto mode is browser-support-exempt so default CLI usage keeps working via the API script; explicit web stays macOS-only.
  • App exposure: new Venice usage-source setting (Auto/API/Web) with a Settings picker, sourceMode routing, and cookie-only availability in web mode (covered).
  • Monthly credits label wired through presentation, menu, and widget seams (covered); gatekeeper allowlist updated.
  • Caller web timeout is honored instead of the hard-coded 15s (covered); error messages are browser-neutral.

Verified: all Venice suites plus gatekeeper/registry/CLI/preflight green, full lint-macos clean.

Copilot AI lite review requested due to automatic review settings September 7, 2026 11:37
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 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-09-07T11:42:10.210149Z aa37649 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.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 7, 2026, 4:05 PM ET / 20:05 UTC.

ClawSweeper review

What this changes

Adds an explicit Venice Web source that reads monthly subscription credits using browser sessions or a stored manual cookie, with source selection and monthly-credit labels.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

Blocked before merge - 11 items remain

This remains a useful, distinct contribution, but the latest settings integration introduces an app-wide crash and ignores disabled cookie access. Earlier review fixes are present; the new live manual-cookie evidence establishes progress but does not cover the remaining integration gaps.

Priority: P1
Reviewed head: eed155514ed0a79df6bafab6389eb659ca8a6efa

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful live quota evidence and focused tests are outweighed by an app-wide integration crash and a cookie-policy bypass.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the reported live fetcher and latest stored-header HTTP 200 results establish real quota retrieval, but do not show Off rejecting browser and network access. Prior local-import, freshly built app, and fresh/upgrade routing demonstrations also remain outstanding. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the reported live fetcher and latest stored-header HTTP 200 results establish real quota retrieval, but do not show Off rejecting browser and network access. Prior local-import, freshly built app, and fresh/upgrade routing demonstrations also remain outstanding. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Repository policy and scope: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-notes directory was present. Applied credential isolation, cookie-access policy, stable model-seam testing, and fresh-bundle UI proof guidance; no builds or tests were executed in this read-only review.
New registration lacks an app snapshot contribution: The new typed settings registration sets defaultContribution to nil through ProviderSettingsSectionRegistration. VeniceProviderImplementation does not override settingsSnapshot, so its inherited implementation returns nil. ProviderRegistry.makeSettingsSnapshot iterates every registered provider and traps at lines 148–150, including when Venice is disabled. The credentialSettings closure supplies the CLI path only.
Disabled cookies reach browser and network access: With source web, cookieSource off, and no selected token account, isAvailable returns true on macOS. fetch handles manual specially and otherwise invokes sessionLoader, then sends the imported session through usageLoader. The pipeline has no independent cookie-policy guard.
Findings 2 actionable findings [P1] Supply Venice's typed settings snapshot in the app
[P1] Reject cookie source Off before importing browser credentials
Security Needs attention Disabled cookie access still consumes browser credentials: Web requests with cookieSource Off can import Chrome or Brave session credentials and send them to Venice despite the user's stored access policy.

How this fits together

CodexBar converts provider credentials and settings into usage snapshots for its menu-bar app and CLI. Venice’s new Web strategy retrieves subscription quota alongside the existing API balance strategy.

flowchart TD
    A[Provider settings and selected account] --> B{Usage source}
    B -->|Auto or API account| C[Existing API balance script]
    B -->|Web| D[Manual cookie or browser session]
    D --> E[Venice session endpoint]
    E --> F[Monthly quota snapshot]
    C --> G[App and CLI presentation]
    F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the reported live fetcher and latest stored-header HTTP 200 results establish real quota retrieval, but do not show Off rejecting browser and network access. Prior local-import, freshly built app, and fresh/upgrade routing demonstrations also remain outstanding. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Supply Venice's typed settings snapshot in the app (P1) - Registering this typed section makes defaultContribution nil, but VeniceProviderImplementation still inherits settingsSnapshot, which returns that default. ProviderRegistry.makeSettingsSnapshot iterates all providers and calls preconditionFailure for this nil result. Consequently ordinary app fetch-context creation crashes even with Venice disabled. Add the app-side snapshot override using the stored Venice cookie settings and cover the complete registry snapshot path; the credentialSettings closure only supplies CLI snapshots.
  • Reject cookie source Off before importing browser credentials (P1) - For a macOS Web request with cookieSource: "off" and no selected token account, isAvailable returns true and this manual-only branch falls through to sessionLoader(), then sends the imported credential to Venice. The newly wired settings therefore violate the documented Off policy. Check Off in availability and before fetch side effects, and add a regression proving neither the session loader nor HTTP request runs.
  • Resolve security concern: Disabled cookie access still consumes browser credentials - Web requests with cookieSource Off can import Chrome or Brave session credentials and send them to Venice despite the user's stored access policy.
  • Resolve merge risk (P1) - The app snapshot defect affects ordinary provider refreshes even when Venice is disabled.
  • Resolve merge risk (P1) - Cookie source Off currently permits importing and sending an ambient browser credential.
  • Resolve merge risk (P1) - Local browser import, freshly built app presentation, and fresh/upgrade Auto/API behavior remain unproven by the supplied live evidence.
  • Complete next step (P2) - Fix both findings and add the remaining after-fix evidence. Use screenshots or video for the native UI and redacted logs or terminal output for credential access and routing; remove private account data and secrets. Update the PR body to trigger re-review, or ask a maintainer to comment @clawsweeper re-review if it does not trigger.
  • Improve patch quality - Add the app settings contribution and a registry-level regression covering Venice enabled and disabled.
  • Improve patch quality - Enforce Off before credential access and prove that disabled access causes no browser import or HTTP request.
  • Improve patch quality - Complete redacted local-browser and freshly built app proof, plus fresh/upgrade Auto/API and saved-account comparisons.

Findings

  • [P1] Supply Venice's typed settings snapshot in the app — Sources/CodexBarCore/Providers/Venice/VeniceProviderDescriptor.swift:35-40
  • [P1] Reject cookie source Off before importing browser credentials — Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift:59-66
  • [medium] Disabled cookie access still consumes browser credentials — Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift:66
Agent review details

Security

Needs attention: The new cookie settings path bypasses an explicit access opt-out; no dependency, workflow, or package-resolution changes were introduced.

Review metrics

Metric Value Why it matters
Production and test growth production +777 net lines; tests +529 net lines The growth supports a new cookie importer, quota parser, settings integration, and focused coverage, but app snapshot and disabled-cookie cases are missing.

Merge-risk options

Maintainer options:

  1. Complete settings integration and enforce Off (recommended)
    Add Venice’s app snapshot contribution, reject disabled cookie access before imports or requests, and cover both boundaries with focused regression tests and after-fix evidence.

Technical review

Best possible solution:

Complete Venice’s app settings contribution and enforce cookie policy before credential access, while preserving Auto/API behavior and demonstrating fresh-install and upgrade compatibility.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: building the app registry settings snapshot reaches a nil Venice contribution, and Web plus cookieSource Off reaches browser import. These introduced failures were not executed during the read-only review.

Is this the best way to solve the issue?

The explicit Web strategy is a reasonable fit, but the current implementation is incomplete: app settings must supply the new typed section, and Off must stop credential access.

Full review comments:

  • [P1] Supply Venice's typed settings snapshot in the app — Sources/CodexBarCore/Providers/Venice/VeniceProviderDescriptor.swift:35-40
    Registering this typed section makes defaultContribution nil, but VeniceProviderImplementation still inherits settingsSnapshot, which returns that default. ProviderRegistry.makeSettingsSnapshot iterates all providers and calls preconditionFailure for this nil result. Consequently ordinary app fetch-context creation crashes even with Venice disabled. Add the app-side snapshot override using the stored Venice cookie settings and cover the complete registry snapshot path; the credentialSettings closure only supplies CLI snapshots.
    Confidence: 0.99
  • [P1] Reject cookie source Off before importing browser credentials — Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift:59-66
    For a macOS Web request with cookieSource: "off" and no selected token account, isAvailable returns true and this manual-only branch falls through to sessionLoader(), then sends the imported credential to Venice. The newly wired settings therefore violate the documented Off policy. Check Off in availability and before fetch side effects, and add a regression proving neither the session loader nor HTTP request runs.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c526fe71721e.

Labels

Label justifications:

  • P1: The new typed settings registration can crash ordinary app provider refreshes, giving this PR broader impact than Venice alone.
  • merge-risk: 🚨 availability: The app requires a settings contribution from every registered provider, and Venice now returns nil.
  • merge-risk: 🚨 security-boundary: An explicit cookie-access opt-out is bypassed before browser credentials are imported and sent.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the reported live fetcher and latest stored-header HTTP 200 results establish real quota retrieval, but do not show Off rejecting browser and network access. Prior local-import, freshly built app, and fresh/upgrade routing demonstrations also remain outstanding. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Disabled cookie access still consumes browser credentials — Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift:66
    Web requests with cookieSource Off can import Chrome or Brave session credentials and send them to Venice despite the user's stored access policy.
    Confidence: 0.99

What I checked:

  • Repository policy and scope: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-notes directory was present. Applied credential isolation, cookie-access policy, stable model-seam testing, and fresh-bundle UI proof guidance; no builds or tests were executed in this read-only review. (AGENTS.md:1, eed155514ed0)
  • New registration lacks an app snapshot contribution: The new typed settings registration sets defaultContribution to nil through ProviderSettingsSectionRegistration. VeniceProviderImplementation does not override settingsSnapshot, so its inherited implementation returns nil. ProviderRegistry.makeSettingsSnapshot iterates every registered provider and traps at lines 148–150, including when Venice is disabled. The credentialSettings closure supplies the CLI path only. (Sources/CodexBarCore/Providers/Venice/VeniceProviderDescriptor.swift:35, eed155514ed0)
  • Disabled cookies reach browser and network access: With source web, cookieSource off, and no selected token account, isAvailable returns true on macOS. fetch handles manual specially and otherwise invokes sessionLoader, then sends the imported session through usageLoader. The pipeline has no independent cookie-policy guard. (Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift:59, eed155514ed0)
  • Existing Off contract: Configuration documentation defines cookieSource off as disabling cookies. ProviderCookieSettingsResolver preserves that value, and the existing Abacus web strategy checks it before becoming available. (docs/configuration.md:126, eed155514ed0)
  • Current main and release still use API balance: Inspected the Venice descriptor on fetched main c526fe7 and release v0.56.8 at 6ef8269. Both advertise only Auto/API and use venice.js; neither implements subscription Web quota. Current docs describe the API billing balance. (Sources/CodexBarCore/Providers/Venice/VeniceProviderDescriptor.swift:64, c526fe71721e)
  • Live proof and continuity: Add Venice web quota strategy #3474 (comment) reports the real fetcher receiving HTTP 200 and parsing 15,349/22,500 credits at f3de3df, while explicitly bypassing local browser import. Add Venice web quota strategy #3474 (comment) reports HTTP 200 and real quota through the new stored-header path at eed1555. This is positive live evidence, but no supplied evidence demonstrates local browser import, the freshly built app, or fresh/upgrade routing comparisons requested previously. (eed155514ed0)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-07T11:40:28.338Z sha aa37649 :: needs real behavior proof before merge. :: [P1] Preserve Venice Auto support on Linux | [P1] Reject token-account scoping before importing browser credentials | [P2] Try subsequent sessions after a session-specific authentication failure | [P2] Connect the monthly label to production presentation
  • reviewed 2026-09-07T13:44:13.089Z sha fdfbfec :: needs real behavior proof before merge. :: [P2] Handle saved token accounts before offering Web mode | [P3] Show the actual source in the Preferences detail
  • reviewed 2026-09-07T13:47:49.283Z sha fdfbfec :: needs real behavior proof before merge. :: [P2] Handle saved token accounts before offering Web mode | [P3] Show the actual source in the Preferences detail
  • reviewed 2026-09-07T14:03:24.278Z sha d19880d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-07T16:08:06.327Z sha f3de3df :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-07T19:06:54.755Z sha 8b46ff6 :: needs real behavior proof before merge. :: none

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The intended “Monthly credits” label helper is not currently wired into UI label selection, and several new user-facing error messages hard-code “Chrome” despite configurable cookie import sources.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new explicit-web-only Venice quota fetch path that reads the signed-in venice.ai session (via imported browser cookies) and derives a monthly refill window from the session JWT, without changing existing auto/API behavior.

Changes:

  • Introduces VeniceWebUsageFetcher to fetch/parse subscription quota from the Venice web session endpoint.
  • Adds a VeniceWebFetchStrategy and wires it into VeniceProviderDescriptor for .web source mode only (no fallback to API key in web mode).
  • Adds cookie import + cookie-header normalization helpers and a new Venice-specific VeniceUsageError model, with comprehensive tests.
File summaries
File Description
Tests/CodexBarTests/VeniceWebUsageFetcherTests.swift New test suite covering JWT parsing, quota mapping, cookie header normalization, and explicit-web gating behavior.
Sources/CodexBarCore/Providers/Venice/VeniceWebUsageFetcher.swift Implements the web session request and JWT-claim parsing into UsageSnapshot + monthly window semantics.
Sources/CodexBarCore/Providers/Venice/VeniceWebFetchStrategy.swift Adds explicit-web-only fetch strategy that imports sessions and calls the web usage fetcher.
Sources/CodexBarCore/Providers/Venice/VeniceUsageError.swift Adds Venice-specific error types and user-facing messages for web/cookie flow failures.
Sources/CodexBarCore/Providers/Venice/VeniceProviderDescriptor.swift Adds .web source mode and selects cookie strategy only for explicit web; adds a helper for a monthly label.
Sources/CodexBarCore/Providers/Venice/VeniceCookieImporter.swift Imports and merges browser cookies (macOS-only) and resolves Venice sessions per profile/source.
Sources/CodexBarCore/Providers/Venice/VeniceCookieHeader.swift Extracts/normalizes the Venice auth cookie (including chunked variants) into a safe Cookie: header.
Review details

Suppressed comments (2)

Sources/CodexBarCore/Providers/Venice/VeniceUsageError.swift:22

  • These error strings also hard-code “Chrome”, but the web strategy/importer can pull cookies from non-Chrome sources; make the messaging browser-agnostic so it stays accurate with configured cookie import order.
        case .anonymousSession:
            "Venice Chrome session is anonymous and has no subscription quota."
        case .expiredSession:
            "Venice Chrome session token is expired. Sign in to venice.ai again."

Sources/CodexBarCore/Providers/Venice/VeniceUsageError.swift:24

  • missingQuota also mentions “Chrome”, but quota parsing is tied to the Venice web session JWT rather than a specific browser; this can mislead users when the cookie came from another browser/profile.
        case .missingQuota:
            "Venice Chrome session did not include subscription quota."
  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +59 to +65
/// Window label for the cookie-based monthly quota view.
public static func primaryLabel(window: RateWindow?) -> String? {
guard window?.windowMinutes == ProviderPaceCapability.monthlyWindowSentinelMinutes else {
return nil
}
return "Monthly credits"
}
Comment on lines +15 to +18
case .missingCredentials:
"Venice Chrome session cookie not found. Sign in to venice.ai in Chrome."
case .invalidCredentials:
"Venice Chrome session is invalid or expired. Sign in to venice.ai again."

@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: aa37649330

ℹ️ 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 +84 to +85
guard context.sourceMode == .web else { return [script] }
return [VeniceWebFetchStrategy()]

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 Expose the explicit web source in the app

Although the descriptor now advertises .web, the app's ProviderRegistry still receives .auto for Venice because VeniceProviderImplementation has neither a sourceMode override nor a source picker, and its availability check still requires an API key/token account. Consequently the menu-bar app can never select this branch—even a cookie-only user who enables Venice remains unavailable—and the new strategy is effectively limited to CLI --source web. Add the corresponding app setting/source-mode and cookie-based availability wiring.

Useful? React with 👍 / 👎.

Comment on lines +47 to +50
guard let session = try self.sessionLoader().first else {
throw VeniceUsageError.missingCredentials
}
let usage = try await self.usageLoader(session.cookieHeader)

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 Retry the remaining imported sessions

When Chrome has multiple signed-in profiles, importSessions() returns every candidate sorted by profile label, but this selects only the first one. If that profile's cookie is expired while a later profile is valid, the request fails with invalidCredentials and the valid session is never tried. Iterate candidates on authentication failures, as the other multi-profile web strategies do, rather than making alphabetical profile order determine whether Venice works.

Useful? React with 👍 / 👎.

Comment on lines +29 to +30
usageLoader: @escaping UsageLoader = { try await VeniceWebUsageFetcher.fetchUsage(cookieHeader: $0) },
sessionLoader: @escaping SessionLoader = { try Self.defaultSessions() })

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 Honor the configured web timeout

The Venice strategy discards ProviderFetchContext.webTimeout and calls a fetcher whose request timeout is hard-coded to 15 seconds. This contradicts the CLI's advertised --web-timeout behavior in CLIOptions.swift:71 and also shortens the app's 60-second budget, so slow Venice responses can fail even when callers requested a longer timeout. Thread context.webTimeout through the loader and apply it to the request.

Useful? React with 👍 / 👎.

Comment on lines +60 to +64
public static func primaryLabel(window: RateWindow?) -> String? {
guard window?.windowMinutes == ProviderPaceCapability.monthlyWindowSentinelMinutes else {
return nil
}
return "Monthly credits"

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 Wire the monthly label into menu rendering

This helper is never called outside its unit test; the repository-wide menu label switch in MenuDescriptor.rateWindowLabels has no Venice branch. Therefore a web snapshot carrying the monthly sentinel still renders the existing metadata label Balance, not the newly intended Monthly credits. Add Venice to that rendering seam so the quota window is identified correctly.

Useful? React with 👍 / 👎.

@audreyt
audreyt force-pushed the feat/venice-web-quota branch from 899dc82 to fdfbfec Compare September 7, 2026 13:40
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 7, 2026
@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

Addressed all four findings: token-account rejection before import, multi-session fallback, Linux auto exemption with CLI preflight coverage, and full app exposure (usage-source setting, picker, sourceMode routing) plus presentation label wiring and timeout threading. Details in the updated PR body.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

Addressed the two new findings: selected token accounts now resolve to the API script at the credential-adapter seam (no ambient fetch, no mislabeling; covered), and the Preferences detail shows the live source label. Details in the updated PR body.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@audreyt
audreyt force-pushed the feat/venice-web-quota branch from d19880d to f3de3df Compare September 7, 2026 16:03
@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

Live proof (head f3de3df): ran the real VeniceWebUsageFetcher.fetchUsage against the live outerface.venice.ai/api/user/session endpoint using the signed-in venice.ai session cookie. HTTP 200, valid JWT, parsed snapshot (numbers only, no secrets):

  • Used this cycle: 15,349 / Monthly allowance: 22,500 (used 68.2%)
  • Subscription remaining: 7,151 | Bank cap: 67,500 | Total credits: 7,651 | Plan: MAX

Scratch live test passed (liveSessionReturnsRealQuota, worktree-only, removed afterwards); the JWT bundledCreditsUsage claim carries all fields the parser requires. No fixture involved — live shape matches the parser contract exactly.

Caveat for QA: the session came from the user's relayed browser, not the local Chrome profile, so --source web cookie auto-import on this machine would still report missing-credentials until venice.ai is signed in via local Chrome. The fetcher + parser themselves are proven live.

Users signed in only in Brave got missing-credentials on --source web. Chrome stays first per cookie-import policy; Brave is second, matching the Alibaba/Augment precedent.
@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

Follow-up (8b46ff6): Venice web import now tries Chrome, then Brave. Rationale: the live session used for the proof above lives in the user's Brave, and local-Chrome-only import would report missing-credentials for Brave-only users. Chrome stays first per repo cookie policy; Brave-second matches the Alibaba/Augment precedent. Adds VeniceBrowserOrderTests; focused Venice batch (33 tests) green, make check clean.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Sep 7, 2026
A configured manual cookie header now feeds the web fetcher directly (Abacus pattern) instead of forcing browser import. Falls back to Chrome/Brave import when the source is auto. Adds VeniceProviderSettings snapshot section plus strategy tests.
@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

Follow-up (eed1555): the web strategy now honors a stored manual cookie header (Abacus pattern) instead of forcing browser import. Motivation: a valid session cookie can exist in config while the browser profile is unreadable (sandboxed relay browsers, TCC-blocked profiles). Adds a VeniceProviderSettings snapshot section wired through the descriptor; browser import (Chrome, then Brave) remains the path when the cookie source is auto. Verified live: stored header returns HTTP 200 with real quota through the new path. Venice batch 36/36 green, make check clean. Note: session cookies rotate, so a stale manual header surfaces the sign-in error until refreshed.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 7, 2026
Registering a Venice settings section without an app-side contribution tripped the startup snapshot precondition and trapped on launch. Mirror the Abacus wiring: SettingsStore snapshot helper plus implementation override.
@audreyt

audreyt commented Sep 7, 2026

Copy link
Copy Markdown
Author

Follow-up (4f8100d): fix launch trap. Registering the Venice settings section without an app-side snapshot contribution tripped the startup assembly precondition (Missing settings snapshot section) and SIGTRAPed on launch; the CLI was unaffected. Mirrors the Abacus wiring (SettingsStore snapshot helper + implementation override) and adds a regression test pinning that the registration accepts the contribution. Venice batch 37/37 green, make check clean, packaged app launch-verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants