feat(workspaces): named groups of repos for federation - #2
Open
spuentesp wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
spuentesp
added a commit
that referenced
this pull request
Aug 20, 2026
PresenceEvent now derives Deserialize (ConflictDetected.severity becomes String — &'static str made the enum 'de: 'static and impossible to deserialize from a borrowed buffer). Every broadcast presence event is tagged with a durable monotonic id assigned by the new EventsLog (<state_dir>/events.jsonl, 50 MB rotation to .1, same policy as audit.jsonl). All emit paths route through LainServer::emit_presence_event or append-then-send in the expiry loop and attribution watcher, so the bus payload is now (u64, PresenceEvent). serve_sse takes the EventsLog and the raw Last-Event-ID header: events with id > last_id replay from the log (in order) before the first live frame; live frames carry the same durable id, so a reconnecting client always resumes from the last id it saw. GET /events passes the header through. Verified at runtime: register_agent + claim_files against a live HTTP server produce durable ids 1-11; GET /events with Last-Event-ID: 8 replays frames 9-11 before live ones; Last-Event-ID at the tip yields backlog-free live streaming (heartbeat_expired id 12 from the expiry loop).
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
Implements the Lain Workspaces feature (spec at `docs/superpowers/specs/2026-08-12-lain-workspaces-design.md`, plan at `docs/superpowers/plans/2026-08-12-lain-workspaces.md`). A workspace is a named subset of repos from `repos.yaml` that the federation engine indexes as a coherent unit, switchable on server restart via `--workspace ` (or `--workspace auto` reading `~/.config/lain/active_workspace`).
What ships
Test results
Critical prerequisite
This PR cannot land before the test-gap fix's PR 1 (Pass A + Pass B in `project_repo`) merges — that was the explicit prerequisite captured in both the spec and the plan. The workspace's headline cross-repo `Calls` semantic depends on the test-gap fix producing those edges. PR 2 of workspaces (dashboard + e2e + docs + agent strategy) is safe to land independently.
Migration / rollout
`repos.yaml` schema unchanged. The federation tool set gains 4 new tools (`list_workspaces`, `get_active_workspace`, `get_workspace`, `get_workspace_graph`); the 6 existing tools are unchanged. Federation mode without a workspaces.yaml is identical to today — operators opt into workspaces by adding a file and passing `--workspace ` (or setting the active workspace pointer).