Skip to content

Fixed #14: Persisted presence state#42

Closed
opencode-agent[bot] wants to merge 1 commit intomainfrom
opencode/schedule-c213b3-20260131060548
Closed

Fixed #14: Persisted presence state#42
opencode-agent[bot] wants to merge 1 commit intomainfrom
opencode/schedule-c213b3-20260131060548

Conversation

@opencode-agent
Copy link

I've successfully implemented the fix for Issue #14 (In-Memory Presence State Not Persisted). Here's a summary:

Changes Made

  1. Database Schema (src/server/db/schema.ts):

    • Added project_presence table for tracking per-project presence state
    • Added project_viewers table for tracking active viewers
    • Both tables have proper foreign key relationships
  2. Database Model (src/server/presence/presence.model.ts):

    • Created new module with database CRUD operations
    • Functions for upserting/querying presence and viewers
    • Includes stale viewer cleanup functionality
  3. Presence Manager (src/server/presence/manager.ts):

    • Refactored from in-memory Map to database-backed operations
    • Maintained all existing functionality (heartbeat, reaper, locking)
    • All presence state now persists across server restarts
  4. Migration (drizzle/0001_rapid_caretaker.sql):

    • Generated migration for new tables
    • Applied successfully to database

Branch Status

✅ Code committed: 4e5f884
✅ Branch pushed: opencode/schedule-c213b3-20260131060548

The GitHub Actions user lacks permissions to create PRs. You can create the PR manually at:

https://github.com/pablopunk/doce.dev/pull/new/opencode/schedule-c213b3-20260131060548

Suggested PR title: Fix #14: Persist presence state to database

Triggered by scheduled workflow

github run

Fixes #14: In-Memory Presence State Not Persisted

Previously, presence state was stored in-memory using a Map, which was
lost on server restart. This could cause unexpected container stops
when all viewers disconnect before the reaper runs after a restart.

Changes:
- Add project_presence table to track per-project presence state
- Add project_viewers table to track active viewers
- Create presence.model.ts with database operations
- Refactor presence manager to use database instead of Map
- Generate and apply migration

The presence state now persists across server restarts, ensuring that
running containers continue to operate correctly and viewer presence
is maintained.
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@opencode-agent
Copy link
Author

User opencode-agent[bot] does not have write permissions

github run

@github-actions
Copy link

🚀 Preview deployed!

Open preview environment

Note: Accessible via Tailscale network

ℹ️ This preview will be automatically cleaned up when the PR is closed.

@pablopunk pablopunk closed this Feb 15, 2026
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