Skip to content

Persist Inbox read state to files#444

Merged
luokerenx4 merged 1 commit into
masterfrom
codex/file-backed-inbox-read-state
Jul 3, 2026
Merged

Persist Inbox read state to files#444
luokerenx4 merged 1 commit into
masterfrom
codex/file-backed-inbox-read-state

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Summary

Persist Inbox read/unread state in the OpenAlice data directory instead of browser localStorage.

  • Keep data/inbox/entries.jsonl as the append-only Inbox notification log.
  • Add a sidecar data/inbox/read-state.json for mutable per-entry readAt state.
  • Return readAt from /api/inbox/history so every client reads the same attention state.
  • Add PUT /api/inbox/:id/read and DELETE /api/inbox/:id/read for read/unread writes.
  • Update the frontend to derive unread badges from server-provided readAt, with optimistic updates reconciled by the next history poll.
  • Mock the new read endpoints in demo mode.

Why

Inbox read state used to live in frontend localStorage (openalice.inbox-read.v2). That survives a reload in one browser profile, but it resets across Electron/browser clients, different frontend instances, and app-mode debugging. App packaging exposed that as the wrong ownership boundary: read/unread is user attention state and should follow the OpenAlice data root, not the UI cache.

The new sidecar file keeps mutable read state separate from the immutable Inbox event log, so marking an entry read does not rewrite entries.jsonl.

Validation

  • User manually tested the app flow and confirmed it works.
  • pnpm vitest run src/core/inbox-store.spec.ts src/webui/routes/inbox.spec.ts
  • npx tsc --noEmit
  • cd ui && npx tsc -b
  • pnpm test
  • git diff --check

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jul 3, 2026 3:41pm

Request Review

@luokerenx4 luokerenx4 marked this pull request as ready for review July 3, 2026 15:43
@luokerenx4 luokerenx4 merged commit be8ce49 into master Jul 3, 2026
5 checks passed
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