Skip to content

fix(project): refresh renamed projects across live clients - #45043

Merged
kitlangton merged 2 commits into
v2from
project-live-updates
Aug 25, 2026
Merged

kitlangton merged 2 commits into
v2from
project-live-updates

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Keep connected OpenCode clients synchronized when a project is renamed or its repository directory moves. Existing TUI tabs update their project labels immediately, without restarting the TUI or reloading every project.

Before / After

Before: A project named show-and-tell appears in an existing TUI tab. Renaming it to behold updates the server's project record, but project.updated is excluded from the public event stream and the TUI retains the old cached metadata. Moving the repository also updates its canonical path without publishing any project change. Closing and reopening the tab does not help because the same client cache survives.

After: Project metadata edits publish their existing project.updated event to connected clients, repository moves publish the same event after updating the authoritative row, and the shared Solid client reconciles only the affected project. The open tab changes from show-and-tell to behold immediately. Project identity, sessions, custom names, and unrelated cached projects remain intact.

How

  • packages/schema/src/event-manifest.ts: Promote the existing canonical project.updated definition into the public server-event manifest without duplicating it in the broader manifest.
  • packages/core/src/project.ts: Detect canonical-directory changes during project resolution and publish the complete persisted project record after the existing upsert. Initial and unchanged resolutions remain silent.
  • packages/client/src/solid/data.ts: Reconcile the updated project directly into the shared reactive project cache instead of refetching the complete project list.
  • packages/client/src/promise/generated/types.ts: Regenerate the public event union to include ProjectUpdated.
  • Add focused regression coverage for event visibility, renamed repositories, preserved custom metadata, repeated resolution, reactive project updates, optional-name removal, and unrelated cache preservation.

Scope

This change fixes live synchronization of existing project metadata and canonical directory changes. It does not alter project identity, add new project-management APIs, modify tab rendering, or address unrelated existing client API-group assertions.

Testing

  • Repository pre-push validation: bun turbo typecheck --concurrency=3 passed across all 32 participating packages.
  • packages/core: bun run test test/project.test.ts test/worktree.test.ts (36 passed, 1 existing skip).
  • packages/schema: bun test test/event-manifest.test.ts test/legacy-event.test.ts (8 passed).
  • packages/client: bun run test test/contract-identity.test.ts test/effect.test.ts test/import-boundaries.test.ts test/promise-service.test.ts test/service.test.ts test/solid-data.test.ts test/solid-pty.test.ts (43 passed).
  • packages/client: bun run check:generated.
  • bun typecheck passed individually in packages/core, packages/schema, packages/client, packages/protocol, packages/server, packages/tui, and packages/app.
  • Matched isolated TUI runs against untouched origin/v2 and this branch: the baseline retains show-and-tell; the fix updates the same open tab to behold.
  • Existing baseline issue: packages/client/test/promise.test.ts already fails on untouched origin/v2 because its expected API groups omit the existing experimental group. That unrelated assertion is intentionally unchanged.

Demo

Identical isolated TUI scenario on origin/v2 (left) and this branch (right). Both start with show-and-tell; after the same project-name update, only the fixed client updates its existing tab to behold.

project-live-updates-before-after.mp4

Flow

sequenceDiagram
    participant Repository
    participant Core as Project Core
    participant Bus as Public Event Stream
    participant Client as Shared Solid Client
    participant TUI as Existing TUI Tab

    Repository->>Core: Resolve renamed canonical directory
    Core->>Core: Upsert existing project and preserve metadata
    Core->>Bus: Publish project.updated with complete Project.Info
    Bus->>Client: Deliver public project.updated event
    Client->>Client: Reconcile the affected cached project
    Client->>TUI: Reactively render the new project label
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant