Skip to content

Fix OpenCode server key normalization across worktrees#426

Open
proboscis wants to merge 1 commit intomainfrom
issue/orch-445/run-20260212-230335
Open

Fix OpenCode server key normalization across worktrees#426
proboscis wants to merge 1 commit intomainfrom
issue/orch-445/run-20260212-230335

Conversation

@proboscis
Copy link
Owner

Summary

  • Normalize OpenCode server identity to the main repo root in ensureOpenCodeServerRunning and getOpenCodeServerPort, so worktree paths cannot create duplicate server registry entries.
  • Update daemon OpenCode launch/continue call sites to pass repo roots, and normalize managed server persistence/reconciliation keys in SQLite startup recovery.
  • Add architecture lint protection and regression tests for worktree-path normalization in both in-memory server registry and persisted managed_servers records.

Acceptance Criteria Evidence

  • ensureOpenCodeServerRunning resolves worktree paths to main repo root before registry lookup (internal/daemon/socket.go).
  • getOpenCodeServerPort resolves worktree paths to main repo root before lookup (internal/daemon/socket.go).
  • One OpenCode server per repo across worktrees: go test ./internal/daemon -run TestEnsureOpenCodeServerRunningNormalizesWorktreeServerKey -v passes.
  • managed_servers SQLite key normalization: go test ./internal/daemon -run TestPersistManagedServerStartNormalizesProjectRootKey -v passes.
  • Semgrep rule added: daemon-no-worktree-path-to-ensure-server in .semgrep/architecture.yaml.
  • make lint passes with no new violations.
  • go build ./... passes.
  • go test ./... currently fails in an unrelated pre-existing test: internal/cli TestApplyConfigDefaultsFallbacks (invalid config schema ... EOF). Daemon package tests pass (go test ./internal/daemon).

Issue: orch-445

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