Skip to content

fix: handle nullable gifted credit grants in desktop rewards#1108

Open
anthhub wants to merge 5 commits intomainfrom
fix/issue-1085-gifted-credits
Open

fix: handle nullable gifted credit grants in desktop rewards#1108
anthhub wants to merge 5 commits intomainfrom
fix/issue-1085-gifted-credits

Conversation

@anthhub
Copy link
Copy Markdown
Contributor

@anthhub anthhub commented Apr 15, 2026

What

Fix desktop rewards so gifted credits continue to render correctly when cloud credit grant records contain nullable expiry timestamps or newer gifted source names.

Why

Closes #1085.

The desktop rewards view could fall back to 0 or misclassify gifted credits as package credits because the shared credit schema rejected real cloud records with expiresAt = null, and the gifted-balance breakdown only recognized a narrow set of source names.

How

  • allow credit grant source values beyond the current known enum while preserving a typed list of known values
  • allow nullable expiresAt values in shared credit schemas to match production cloud data
  • treat gifted grants with missing expiry as active balance
  • classify gifted grants using both known source names and gifted-related source/metadata hints
  • add controller tests covering nullable expiry timestamps and future gifted source names

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)
  • Web dashboard (React UI)
  • OpenClaw runtime
  • Skills
  • Shared schemas / packages
  • Build / CI / Tooling

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Notes for reviewers

Validated end-to-end in the desktop app against the real local rewards flow: the sidebar balance card and the expanded rewards popover both show gifted balance separately from package balance.

@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 21.15385% with 41 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
e2e/desktop/tests/packaged-e2e.mjs 0.00% 21 Missing ⚠️
apps/controller/src/store/nexu-config-store.ts 28.57% 20 Missing ⚠️

📢 Thoughts on this report? Let us know!

anthhub added 4 commits April 16, 2026 16:20
The controller ready endpoint does not return openclawPort, so the
E2E test always fell back to 18789. When that port is occupied on
the CI runner, OpenClaw auto-assigns a different port and the health
check times out. Scan 18789-18791 to match the bash harness behavior.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 16, 2026

Deploying nexu-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c49549a
Status: ✅  Deploy successful!
Preview URL: https://0ca5cc4b.nexu-docs.pages.dev
Branch Preview URL: https://fix-issue-1085-gifted-credit.nexu-docs.pages.dev

View logs

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.

[Bug][Credits] Gifted credits incorrectly categorized as Package credits

2 participants