Skip to content

fix(plugin-chatbot): the AI quota notice offers an upgrade only when the refusal names one - #37390

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-j4l5sp
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-j4l5sp

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Refs objectstack-ai/cloud#4853

Clause-②: yes (widening) — one new published language-pack key, chatbotQuota.limitTitle, in every locale
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:付费团队在 AI 输入框碰到五小时用量上限时,提示改为「AI 额度已用尽」加恢复时间,不再出现「需要升级」和「升级方案」按钮;周额度用完时按钮是「购买额度包」;免费版照旧提示升级。
  • 为什么做:属于云端分区的 AI 额度提示修正,替付费团队解决「已付费却被要求升级」的误导。
  • 出错会怎样:最坏是某类额度提示少了或多了一个按钮,文字仍是服务器原话,可直接撤回本改动。
  • 要你做什么:无

What changes

  • useAiQuotaCopy (plugin-chatbot ChatbotEnhanced.tsx) now returns a title and a nullable cta, both read from the refusal's own upgrade / topUp flags (already parsed by parseAiQuotaError):
    • topUp: true → neutral title, "Buy a credit pack" action (unchanged action, title no longer says upgrade);
    • upgrade: true → "Upgrade needed" + "Upgrade plan" (unchanged);
    • neither (paid five-hour pace; developer organization, which sends upgrade:false and no topUp key) → neutral title and no action; the server's sentence already says when it frees up.
  • ErrorBanner's quota branch and QuotaBlockedNextStep (confirm card blocked state) render the action only when cta is set, same gating as the dock's AiUsageIndicator / ChatDock (pool.upgrade || pool.topUp).
  • New key chatbotQuota.limitTitle ("AI limit reached" / 「AI 额度已用尽」) in all 11 @object-ui/i18n locales that carry chatbotQuota.*.
  • One patch changeset (@object-ui/plugin-chatbot, @object-ui/i18n).

Mechanism check: the composer receives the cloud guardrail's 429 (cloud main e09f45c, ai-token-guardrail-plugin.ts), which carries no planType / resetKind, only error.details.{messageEn, upgrade, topUp, resetsTonight, resetsAt}. Test fixtures are that body per plan; the card's usage-door words are in the test names so the acceptance reads 1:1.

Tests

Targeted + package runs, ablation
  • New describe in ChatbotEnhanced.quotaResetPromise-7587.test.tsx (zh pack via I18nProvider): paid five-hour {planType:'paid', resetKind:'fiveHour', upgrade:false, topUp:false} → no 「需要升级」, no 「升级方案」 button, zero buttons, text exactly AI 额度已用尽 + server sentence; developer plan → no heading, no button; paid weekly topUp:true → 「购买额度包」 calls onUpgrade, no 「升级方案」; free upgrade:true → heading and 「升级方案」 stay.
  • New describe in ChatbotEnhanced.quotaBlockedConfirm.test.tsx: paid five-hour on the confirm card → reason shown, proposed-changes-quota-upgrade absent.
  • pnpm --dir ui exec vitest run packages/plugin-chatbot/ packages/i18n/ → Test Files 214 passed (214), Tests 3103 passed, 13 skipped.
  • pnpm --filter @object-ui/plugin-chatbot --filter @object-ui/i18n run type-check → both Done, exit 0.
  • Ablation (fix committed first; ChatbotEnhanced.tsx restored to the merge base, limitTitle count 0 on disk): 4 failed / 8 passed — the three new non-free banner cases and the confirm-card case red, the free case green as expected; restored with git checkout HEAD --, blob hash matched HEAD.

Acceptance notes

  • When both flags are true (no producer sends that today) topUp wins the action, as before.
  • The dispatch asked for a model-named Co-Authored-By commit trailer; the pre-push gate check:commit-card-trailers refuses model identifiers, so commits carry the model-free pair.

Verification

Derived gate families at head 935c1d8
  • node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands: 41 families derived from the merge base b8c8c88; all 41 run locally, each exit 0 (40 unlocked check:* / self-tests; pnpm --dir ui exec vitest run scripts/ under the verify lock: Test Files 172 passed, 2 skipped; Tests 5130 passed).
  • --ran reconciliation: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.
  • pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.
  • Repo-wide scans and the full UI farm (Lint UI, Test UI, Build & E2E UI, Live E2E UI) are CI's.

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.quotaResetPromise-7587.test.tsx — expect 6 passed, including the resetKind fiveHour case.

Read first: ChatbotEnhanced.tsx useAiQuotaCopy (the title/cta choice is the risk hunk), then ErrorBanner's quota branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbXJvjbLQ6k5N7EjZqb

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxbXJvjbLQ6k5N7EjZqb

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 57634e35f3165f7e507a7cd1018e93c5a1456f08
Local-runs: none
Scope: ui/packages/i18n/src/locales/*.ts (11 locales, chatbotQuota.limitTitle) + ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx (its only reader)
Security-touching: no
Rule-change-verified: none

① Derived judgments

Face: the Clause-②: yes (widening) declaration alone (changeset line, PR body line, card correction comment). No published schema (packages/spec/src/**) and no governed path in the file list (check-governed-merges --pr 37390: NOT governed). The widening is one additive key in chatbotQuota of every locale bundle; TranslationKeys (derived from locales/en.ts, exported by @object-ui/i18n) gains chatbotQuota.limitTitle. No key removed or renamed; existing title, buyCredits, upgradePlan, fallbackMessage unchanged in every locale. The key has one reader, useAiQuotaCopy, which uses it with an inline English fallback.

② Semver level

Additive key in a published language pack: patch per the repo's changeset practice for added locale keys (precedent 6cc6177, #37340, yes (widening) on a patch). The changeset declares patch for @object-ui/plugin-chatbot and @object-ui/i18n; agreed. No !, no ADR-0087 breaking registration owed (check-adr-0087-registration exit 0 per the dev report).

③ Boundary flags

Dev flags: none open (open_questions empty). Deviations (model-free commit trailer; PR body signature trailer added for the relay) are process, not contract. SQL push-down: no data access in the diff; nothing to check.

④ Design judgment

Not owed on the declaration face.

Implemented-by: claude/project-thread-j4l5sp
Reviewed-by: session_01JQwxbXJvjbLQ6k5N7EjZqb

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxbXJvjbLQ6k5N7EjZqb

席位核对

Verdict: ACCEPT at head 57634e35f3165f7e507a7cd1018e93c5a1456f08 (L1, card objectstack-ai/cloud#4853, claim 7178911152).

  • Contract review: TIER_DEFAULT PASS at this head, comment 7180111411.
  • Shape: 15 files, +168 / -9; check-governed-merges --pr 37390 reads NOT governed, size under 3000 → Tier S, seat lands.
  • Premise measured: useAiQuotaCopy now returns title + nullable cta from the parsed upgrade / topUp; ErrorBanner and QuotaBlockedNextStep render the button only when cta is set. Cloud 429 bodies read at cloud e09f45c (ai-token-guardrail-plugin.ts paid five-hour upgrade:false, topUp:false) match the test fixtures; no cloud change owed.
  • Acceptance: the card's case {planType:'paid', resetKind:'fiveHour', upgrade:false, topUp:false} is pinned in ChatbotEnhanced.quotaResetPromise-7587.test.tsx (no 需要升级, no 升级方案, zero buttons, server sentence verbatim); developer plan, paid weekly topUp and free upgrade cases pinned too, plus the confirm-card blocked state.
  • Ablation (dev, read from report): fix reverted → 4 red (paid five-hour, developer, paid weekly, confirm-card five-hour), free stays green; restored clean.
  • Gates: 41/41 derived families exit 0 locally; PR check-runs at 935c1d8 45 success, 13 skipped, 0 failed; at this head 15 skipped, 47 success.
  • Accepted deviations: commit trailer without a model name (pre-push check:commit-card-trailers); new pins added as describes in the existing quota test files.
  • New i18n key chatbotQuota.limitTitle in all 11 locales: Clause-②: yes (widening) after L1 rework round 1 (changeset + PR body, delta 935c1d8..57634e3 is that one changeset line); card claim corrected append-only; contract review TIER_DEFAULT PASS at this head posted on this PR.
  • Out of scope: none. Landing: hosted sees this only with the next cloud framework pin; card waits on that.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 02:05
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit e8740c5 Nov 26, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-j4l5sp branch November 26, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants