feat: add isolated multi-account metering and device switching - #1
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
CODEX_HOMEand cached login.-Labelalias available for privacy-sensitive deployments.🧩 Scope
🔍 Problem and approach
The host previously followed one mutable Codex credential cache, so signing in to another account replaced the only identity visible to the meter. The new account registry creates isolated login homes and reconciles them on each global scheduling tick. Initial profiles warm serially; steady state polls at most one due profile per tick, avoiding a burst of concurrent account requests.
The host sends a bounded additive
accounts[]list while retaining the original top-level v1 fields for compatibility. The firmware keeps selection by stable profile ID, ignores account controls when only one account exists, and renders the selected identity on both pages. GPIO18 uses short press for next and long press for previous; an independent external GPIO0 button remains opt-in because the reference board's onboard GPIO0 key also affectsCHIP_PU.🔄 Compatibility and user impact
CODEX_HOMEas a one-account fallback.✅ Verification
npm test— 91/91 passednpm run test:docs— 14 bilingual files passednode --check public/app.jsexample.comaccountsgit diff --checkThe final privacy-only serial-log change was rebuilt after hardware validation; it removes identity text without changing the transport or selection path.
🖼️ Screenshots and compatibility
Deterministic SDL overview and details screenshots were reviewed locally with synthetic account addresses. Generated screenshots are intentionally not committed. The shared production
meter_ui.csource is used by both SDL and the device firmware.🔐 Security checklist
host.json, OAuth data, cookies, private logs, local paths, device identifiers, or local runtimes are committedauth.jsonand localaccounts/registriesexample.com/example.orgfixturestextContentn/Nposition, never the email or aliasFull email display is intentional product behavior and is limited to the loopback dashboard/API plus authenticated device transport. OpenAI access/refresh tokens, API keys, cookies, passwords, and auth-file contents are explicitly excluded from normalized and device payloads.