Skip to content

lane: WorkBuddy speaks the CN publishment too, and checks in daily (rebased #89) - #93

Merged
LAGcomcom merged 1 commit into
masterfrom
pr-89-rebased
Oct 17, 2026
Merged

LAGcomcom merged 1 commit into
masterfrom
pr-89-rebased

Conversation

@LAGcomcom

Copy link
Copy Markdown
Owner

Replays @ghshhf's #89 onto the current master. The original went mergeable=false once #90/#88/#86 landed (they touch workbuddy_account.go, main.go, admin.go, index.html, client.go — all overlapping), so this rebases it cleanly: 8 files, +521/-47 ignoring whitespace, matching the original's +534/-60.

The change itself is unchanged and well-motivated: WorkBuddy previously rejected any issuer not naming workbuddy.ai, so a codebuddy.cn (CN publishment) account couldn't be added at all. This teaches the lane both realms — and the two publishments are genuinely different hosts (chat on copilot.tencent.com, meter on www.codebuddy.cn), which is why the daily CN reward is a real /checkin endpoint rather than the intl activity-conversation, and why a realm config object replaces the old single "base per channel".

Conflict resolution done here:

  • client.go: took master (now carrying the CodeArts caMu/caAcct fields) and inserted only the wbLoginRealm field on top.
  • workbuddy_test.go: kept BOTH sides — lane: the daily activity claim rides the chat envelope (#85) #88's TestWorkBuddyDailyActivityUsesTheChatEnvelope and this PR's CN realm tests — which is why the file's line count looked large in the raw diff but the whitespace-only diff is the true +159.

Verified: go vet + go test ./... green (all WorkBuddy tests pass, 9 cases). Smoke: /admin/api/workbuddy/status reports the new realm/canCheckin/lastCheckinDate fields, an un-logged-in /workbuddy/checkin returns {ok:true,skipped:true}, dashboard JS passes node --check.

Credit: @ghshhf — rebase + conflict resolution only, the design is theirs.

… daily

The channel could only ever log into workbuddy.ai — wbAccountFromToken
refused any other issuer outright, so a codebuddy.cn account could not be
added at all. The two publishments now ride a realm table: chat on
copilot.tencent.com, the billing meter on www.codebuddy.cn (a different
host, which is why the meter 404'd when asked on the chat one), each with
its own Origin/X-Domain/UA family. The realm is the login the user opened,
unless the token's issuer names one — a silent issuer must not silently
downgrade a CN account to intl.

CN also earns its daily differently. intl claims it with a tiny
conversation; CN has a real endpoint for it, /v2/billing/meter/
daily-checkin, which answers HTTP 400 with code 10001 once the day is
claimed — so the day closes on that code too, instead of retrying hourly
against a wall. The hourly tick runs whichever daily the account's realm
has; the card grows a 版本 picker and a 签到 button for CN.

The static free-model catalog is untouched: hy4-preview-f, hy3 and
deepseek-v4.1-flash exist on both publishments.

go vet ./... and go test ./... are green.
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