Skip to content

Add workspace isolation and global proxy - #537

Open
dbpolito wants to merge 31 commits into
mainfrom
feature/workspace-proxy
Open

Add workspace isolation and global proxy#537
dbpolito wants to merge 31 commits into
mainfrom
feature/workspace-proxy

Conversation

@dbpolito

Copy link
Copy Markdown
Member

Ticket

SKIPPED

Description

Add provider-neutral workspace isolation for Rift and Git worktrees, backed by dedicated Compose projects and a managed global Caddy proxy. Workspace lifecycle commands now coordinate source and workspace projects safely, while deterministic route ordering and cleanup keep source, tenant, Vite, and HTTPS traffic isolated.

Checklist

Workspace Lifecycle

  • Isolate configured services in Rift and Git worktree Compose projects
  • Show source and contextual workspace state in kool status
  • Stop owned workspaces before the source project from main

Proxy Routing

  • Manage HTTP and HTTPS routes through a global Caddy container
  • Order specific workspace routes before broad source wildcards
  • Reconcile stale routes without affecting unrelated projects

Runtime Integration

  • Initialize workspace context after --working_dir is applied
  • Propagate supported agent environment variables into containers
  • Document workspace, routing, and local HTTPS configuration

Validation

  • Verify the full race-enabled Go test suite passes
  • Confirm golangci-lint reports zero issues
  • Check the rebuilt /usr/local/bin/kool matches the development binary

- support Rift and Git worktree Compose isolation and lifecycle management
- add deterministic global Caddy routing with HTTP and HTTPS support
- show and stop source and workspace projects safely
- propagate agent environment context and document workspace configuration
@dbpolito dbpolito self-assigned this Aug 11, 2026
- compare canonical working-directory paths on macOS
- upgrade Go security dependencies to patched releases
- skip workspace and proxy discovery unless configured
- preserve legacy status, share, start, and stop behavior
- isolate recursive working-directory environment changes
- restore temporary Compose overrides and reject mixed listener modes
- map custom external networks through a stable Compose key
- safely switch listeners between HTTP and HTTPS
- remove stale TLS policies and cover regressions
- clear environment values loaded by the parent project
- preserve shell-provided environment precedence
- isolate child Compose overrides and restore the parent context
- distinguish newly created routes from existing updates
- roll back only routes created by the failed prepare attempt
- cover repeated route registration behavior
- snapshot and restore Caddy apps when preparation fails
- serialize readiness, route updates, and reconciliation
- preserve prepared routes when Compose start fails
- serialize route and TLS removal and reject duplicate host claims
- hash canonical workspace paths to avoid basename collisions
- exclude Compose one-off containers from workspace status
- remove project routes and TLS policy under one lock
- reject shared exact host patterns across projects
- preserve workspace hash suffixes for long names
- expose the Caddy Admin API only through a private Unix socket
- roll back failed starts when proxy state remains unchanged
- preserve concurrent Caddy updates during conditional rollback
- bind Caddy admin to a dedicated management interface
- recreate legacy proxy containers and reject stale autosaves
- retain conditional startup rollback without Unix socket coupling
- reject the proxy admin network for application routing
- reject routes that claim Caddy admin port 2019
- cover both configuration validation failures
- always start Caddy from the generated secure base config
- avoid substring-based trust of persisted autosaves
- cover startup command security assumptions
- inspect stored proxy entrypoint and command during readiness
- recreate containers that can still resume autosaves
- cover secure and legacy compatibility signatures
- reapply desired routes and TLS after Compose succeeds
- stamp route state with a per-prepare generation
- prevent failed starts from matching another start state
- return final proxy reconciliation failures from start
- keep failed-start rollback errors observable
- detect attached recursive working-directory shorthand forms
- remove only failed-generation routes after concurrent updates
- roll back foreground proxy state when Compose exits
- join preparation and snapshot restoration failures
- merge failed generations with pre-start project routes
- preserve unrelated concurrent route and TLS updates
- snapshot and restore failed final reconciliation
- merge rollback changes into lossless Caddy app JSON
- conditionally restore listener protocol and TLS policy presence
- preserve unrelated server and application fields
- gate TLS rollback on active failed-generation ownership
- preserve listener mode when surviving routes remain
- cover newer same-project TLS and shared listeners
- compare surviving project routes with committed state
- restore TLS when only unchanged project routes survive
- cover partial-start rollback with unrelated updates
- recreate proxy with the union of listener ports and networks
- restore complete Caddy apps after listener expansion
- clear global network across recursive directory contexts
- recreate the original proxy after expansion failures
- restore prior ports, networks, readiness, and Caddy apps
- join expansion and container rollback failures
- snapshot live Caddy apps before legacy container removal
- retain existing listener ports and connected networks
- use transactional recreation rollback for migration failures
- retain host IP and host-to-container port mappings
- reuse exact bindings during migration and rollback
- remove or restore failed-generation listener servers
- exclude inherited Admin bindings from replacements
- preserve explicit IPv4 host binding addresses
- emit Docker-compatible bracketed IPv6 publishes
- canonicalize directory keys across macOS symlink paths
- remove obsolete proxy helpers flagged by lint
- keep recursive environment tracking platform-independent
- restart stopped proxy containers before Admin API access
- bind Caddy admin to the Docker-published interface
- cover reachable base configuration and readiness paths
- keep identity hashes out of public workspace URLs
- retain hashes only for internal Compose isolation
- stop the global proxy after its final managed route is removed
- start and await existing stopped Caddy containers
- inspect listener ports only after Admin readiness
- keep last-route automatic shutdown restartable
- keep clean hostnames for normally unique workspaces
- detect duplicate Git worktree basenames from the worktree list
- add identity suffixes only when hostname uniqueness requires them
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