Skip to content

[codex] Add Sakana AI usage provider#1728

Open
LeoLin990405 wants to merge 6 commits into
steipete:mainfrom
LeoLin990405:feat/sakana-provider
Open

[codex] Add Sakana AI usage provider#1728
LeoLin990405 wants to merge 6 commits into
steipete:mainfrom
LeoLin990405:feat/sakana-provider

Conversation

@LeoLin990405

Copy link
Copy Markdown
Contributor

Summary

  • add Sakana AI as a manual web/cookie provider with SAKANA_COOKIE and config cookieHeader support
  • fetch https://console.sakana.ai/billing and parse the billing page's plan label plus 5-hour and Weekly usage limit windows
  • register Sakana across provider metadata, app settings, docs, icon resources, widgets, and unsupported cost/debug fallbacks

OpenCLI notes

  • inspected the Sakana AI console with opencli; the overview/billing data is rendered in the console HTML/Next payload rather than exposed by a clean documented JSON API
  • the billing page renders the plan card and usage-limit rows with percent-used and reset text for 5-hour and Weekly windows
  • this PR intentionally does not add browser-cookie auto-import; users must paste an explicit Cookie header/config value

Validation

  • make check
  • swift test --filter 'Sakana|ProviderConfigEnvironmentTests|ConfigurationDocsProviderIDTests|ProviderIconResourcesTests'

Risk

  • draft because the implementation parses console HTML, so future Sakana UI markup changes may require parser updates.

@clawsweeper

clawsweeper Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 9:19 AM ET / 13:19 UTC.

Summary
The branch adds a disabled-by-default Sakana AI usage provider with manual Cookie/config support, billing-page HTML parsing, provider registration, docs, icon/widget fallbacks, and focused tests.

Reproducibility: not applicable. as a bug reproduction; this is a feature PR. The changed parser/fetcher behavior is source-checkable from the PR head, and the contributor supplied redacted live Sakana billing output for the central runtime path.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 20 files, +612/-7. The PR touches core provider registration, app settings, CLI gating, widgets, docs, icons, and tests, so maintainers should review it as a full provider addition.
  • Focused coverage: 1 new Sakana test file plus 2 existing test files extended. The added tests cover the fetcher/parser, provider config environment override, and Linux CLI web-gating edge cases that were previously called out.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Get explicit maintainer sign-off on the disabled-by-default manual-cookie and HTML-parser provider boundary before merge.

Risk before merge

  • [P1] This adds auth-provider surface because users must paste a live Sakana console Cookie header into config or SAKANA_COOKIE; maintainers should explicitly accept that storage and support boundary before merge.
  • [P1] The provider intentionally parses Sakana console HTML/Next-rendered billing markup rather than a documented API, so future Sakana UI changes can break usage parsing even though the current parser is better bounded.
  • [P1] GitHub still showed macOS test shards in progress at review time, so the normal merge gate should wait for the full required check set.

Maintainer options:

  1. Accept the provider-auth boundary (recommended)
    Merge after a maintainer explicitly accepts the disabled-by-default Sakana manual Cookie header and console-HTML parser as a supported first-class provider surface.
  2. Pause for custom-provider direction
    Hold or close this PR if maintainers prefer Sakana-like long-tail integrations to wait for the declarative custom-provider work tracked separately.
  3. Ask for narrower auth documentation
    Before merge, require one Sakana-specific note that users should paste only the billing-origin Cookie header and redact it from logs/screenshots.

Next step before merge

  • [P2] No narrow automated repair remains; the next action is maintainer review of the provider/auth boundary plus normal CI completion.

Security
Cleared: No concrete security or supply-chain defect was found in the diff; the new credential surface uses existing config/secure-field/log-redaction patterns and has no new dependency or script execution path.

Review details

Best possible solution:

Land the disabled-by-default first-class provider only after maintainer sign-off on the manual-cookie and HTML-parser boundary; otherwise defer Sakana to a broader custom-provider direction.

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

Not applicable as a bug reproduction; this is a feature PR. The changed parser/fetcher behavior is source-checkable from the PR head, and the contributor supplied redacted live Sakana billing output for the central runtime path.

Is this the best way to solve the issue?

Yes for the implementation shape: it follows the existing descriptor, strategy, settings, config, and test patterns and keeps the provider disabled by default. The unresolved question is product/auth acceptance of a first-class provider based on manual cookies and console HTML parsing.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ada3660e9d61.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR discussion includes redacted live-output proof from a real Sakana billing-page fetch, with plan and quota fields parsed and private values omitted.
  • remove status: 🔁 re-review loop: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority new provider integration with bounded blast radius because it is disabled by default but still adds meaningful provider/auth behavior.
  • merge-risk: 🚨 auth-provider: Merging exposes a new provider credential path where users supply a live Sakana console Cookie header via config or environment.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR discussion includes redacted live-output proof from a real Sakana billing-page fetch, with plan and quota fields parsed and private values omitted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR discussion includes redacted live-output proof from a real Sakana billing-page fetch, with plan and quota fields parsed and private values omitted.
Evidence reviewed

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame points the provider enum, descriptor registry, fetch-plan model, CLI web-gating path, and provider docs to commit f380287, which is the baseline touched by this PR. (role: provider architecture and current-main area owner; confidence: high; commits: f380287041b8; files: Sources/CodexBarCore/Providers/Providers.swift, Sources/CodexBarCore/Providers/ProviderDescriptor.swift, Sources/CodexBarCore/Providers/ProviderFetchPlan.swift)
  • Lucas Fonseca Mundim: Recent current-main work on the Mistral cookie provider touched cookie import/fetch behavior similar to this PR's manual web-cookie provider surface. (role: recent adjacent cookie-provider contributor; confidence: medium; commits: c6399fedc4a8; files: Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift, Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift, Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift)
  • BAKEZQ: Recent current-main provider configuration work touched the same config/testing area used by the Sakana cookieHeader environment override path. (role: recent adjacent config/test contributor; confidence: medium; commits: 2435c93453fe; files: Tests/CodexBarTests/ProviderConfigEnvironmentTests.swift, docs/configuration.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Jun 23, 2026
@LeoLin990405 LeoLin990405 marked this pull request as ready for review June 24, 2026 01:37
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. label Jun 24, 2026

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

ℹ️ 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 thread Sources/CodexBarCore/Providers/Sakana/SakanaUsageFetcher.swift Outdated
@LeoLin990405

Copy link
Copy Markdown
Contributor Author

Addressed the current P2 in 0bad8fdd:

  • Kept Sakana usage percentages in usedPercent only and stopped putting them into resetDescription.
  • Added a regression for an unparsed reset date to ensure the UI does not render a fake reset line like Resets 92% used.

Validation:

  • swift test --filter 'Sakana'
  • make check

Proof note: I checked local env/config presence without printing secret values. No Sakana cookie is available here, so I still cannot produce a real billing-page fetch proof from this machine.

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 24, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 0bad8fdd18

ℹ️ 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".

@LeoLin990405

Copy link
Copy Markdown
Contributor Author

Addressed the live Sakana proof gap in f23516ec:

  • The real Sakana billing page can omit a 5-hour reset line while still rendering the 5-hour percentage.
  • Updated the parser so a window only requires the label plus the following % used value; Resets on ... is optional and still maps to resetsAt when present.
  • Added a regression for a window without reset text so the UI still gets the 5-hour window and keeps resetDescription nil.

Redacted live behavior proof

Ran a temporary local proof harness against the current PR head (f23516ec) using the Sakana provider fetcher with a Cookie header imported from the local Chrome profile. The harness was removed after the run; no proof-only code is part of this PR.

No cookie values, account identifiers, invoice URLs, raw HTML, raw response bodies, IP addresses, API keys, or private endpoints are included below.

{
  "provider": "sakana",
  "fetchSource": "web",
  "billingURL": "https://console.sakana.ai/billing",
  "cookieSource": "Chrome profile",
  "cookieHeaderPresent": true,
  "cookieCount": 3,
  "planNamePresent": true,
  "priceLabelPresent": true,
  "fiveHourRendered": true,
  "fiveHourWindowMinutes": 300,
  "fiveHourUsedPercent": 0,
  "fiveHourResetPresent": false,
  "fiveHourResetDescriptionNil": true,
  "weeklyRendered": true,
  "weeklyWindowMinutes": 10080,
  "weeklyUsedPercent": 32,
  "weeklyResetPresent": true,
  "weeklyResetDescriptionNil": true,
  "identityLoginMethodPresent": true,
  "timestamp": "2026-06-24T12:56:24Z"
}

Validation:

  • swift test --filter SakanaUsageFetcherTests
  • swift test --filter Sakana
  • make check

Maintainer sign-off still requested: this provider depends on Sakana console HTML/Next markup rather than a documented API, and uses a manual Cookie header path.

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 24, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 24, 2026

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

ℹ️ 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 thread Sources/CodexBarCore/Providers/Sakana/SakanaUsageFetcher.swift Outdated
@LeoLin990405

Copy link
Copy Markdown
Contributor Author

Addressed the two new P2s in 84a1c067:

  • Linux CLI/manual Cookie: sourceModeRequiresWebSupport now allows Sakana auto/web on non-macOS when SAKANA_COOKIE or config-derived cookieHeader resolves to a valid Cookie header, so the request reaches SakanaWebFetchStrategy instead of returning the generic web-unsupported error.
  • Quota parsing: Sakana window parsing now first bounds extraction to the current quota block before reading % used / reset text. If a window label is present but its own % used paragraph is missing, that window stays nil instead of borrowing the next window's percentage/reset.

Validation:

  • swift test --filter SakanaUsageFetcherTests
  • swift test --filter CLIEntryTests/test_sourceModeRequiresWebSupportIsProviderAware
  • make check

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 24, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 24, 2026
@clawsweeper clawsweeper Bot added the status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. label Jun 24, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 84a1c067b6

ℹ️ 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".

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant