Skip to content

fix(hosted): stabilize workspace ownership - #33

Merged
dajiaohuang merged 1 commit into
mainfrom
fix/hosted-stable-workspace-owner
Aug 29, 2026
Merged

fix(hosted): stabilize workspace ownership#33
dajiaohuang merged 1 commit into
mainfrom
fix/hosted-stable-workspace-owner

Conversation

@dajiaohuang

Copy link
Copy Markdown
Collaborator

Problem

Hosted Worker used worker:<ephemeral port> as the owner stored in its workspace marker. A retry or process restart on another port therefore could not reclaim the same persisted conversation workspace, even though the trusted Host intentionally selected the same path.

Solution

  • require the trusted supervisor to pass a stable, per-workspace --workspace-id
  • hash that ID together with the canonical workspace path into an opaque marker owner
  • keep the existing marker/path/owner checks, active-workspace protection, TTL/LRU/capacity limits, symlink exclusions, and fail-closed cleanup behavior unchanged
  • document that the ID is Host-managed and must never come from player/model input

The path binding prevents one stable ID from silently naming another workspace. A different owner still cannot claim an existing marker.

Integration contract

Supervisors launching sagasmith-agent-worker must add:

--workspace-id <stable-host-issued-workspace-id>

Retries and restarts for the same persisted workspace must reuse the same value even when the worker port changes. Different workspaces must receive different values.

Verification

  • uv run ruff check nanobot --select F
  • uv run ruff check nanobot/apps/hosted_workspace.py nanobot/apps/hosted_worker.py tests/apps/test_hosted_workspace.py tests/apps/test_hosted_worker.py
  • uv run python -m pytest -q tests/apps (26 passed)
  • uv run python -m pytest -q tests (5390 passed, 73 skipped)

Regression tests cover a port-changing restart/retry, path binding, cross-owner rejection, ambiguous ID rejection, and the required CLI contract.

@dajiaohuang
dajiaohuang merged commit c274c17 into main Aug 29, 2026
11 checks passed
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