Skip to content

feat: proxy reports its mounted workspace - #154

Open
Anuj-72 wants to merge 2 commits into
itigges22:devfrom
Anuj-72:feat/proxy-workspace-endpoint
Open

feat: proxy reports its mounted workspace#154
Anuj-72 wants to merge 2 commits into
itigges22:devfrom
Anuj-72:feat/proxy-workspace-endpoint

Conversation

@Anuj-72

@Anuj-72 Anuj-72 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The proxy was bound to ~/snake-game while VS Code had ~/demo2 open. Every tool call was truthful and useless. alignment.ts (#145) asks atlas workspace, but that needs the CLI on PATH, and the proxy never reported what it had mounted.

GET /workspace returns project_dir (host bind), working_dir, containerized. Behind the service token — it discloses a host path, so it is deliberately not in the /health, /ready, /version exemption list. The extension consults it first and falls back to the CLI.

Two decisions worth review:

  • project_dir is emptied unless absolute. Compose defaults ATLAS_PROJECT_DIR to ".", which resolves against the container's cwd, not the host's — reporting it raw makes every client conclude mismatch. Empty means "cannot tell".
  • The endpoint is authoritative for "no" only. It knows the proxy's bind, not the sandbox's; only atlas workspace sees a SPLIT. So a proxy-side match still consults the CLI. Two tests fence this — collapsing it into one early return silently reintroduces the split-brain case.

containerized stats /.dockerenv, since the local launcher also sets ATLAS_WORKSPACE_DIR (runtime.py:283).

Also fixed: Compose passed ATLAS_PROJECT_DIR only at compose-time, so it never reached the container and the endpoint would have had nothing to report. The K3s manifest sets it from ATLAS_PROJECTS_DIR.

Tests: Go pass (vet/gofmt clean), 145 vitest (tsc/eslint clean), 90 contract tests including OpenAPI↔route and OpenAPI↔API.md parity. Both behavioral guarantees are mutation-tested.

Verified live: proxy run standalone (no llama/lens needed) — /workspace returns 200 with the token, 401 without and on a wrong token, 405 on POST, and empties project_dir when ATLAS_PROJECT_DIR=".". The containerized:true branch is unit-tested only.

Anuj-72 added 2 commits August 4, 2026 14:09
- add handleWorkspace() route in main.go
- pass ATLAS_PROJECT_DIR via docker-compose.yml
- add a total of 7 subtests in main_test.go
- add 6 in TestHandleWorkspace + 1 in TestRequireServiceToken
- update proxy_openapi.yaml, atlas-proxy-deployment.yaml.tmpl
- update API.md, CHANGELOG.md
checkAlignment now takes an optional client and consults GET /workspace
first, so a wrong-folder session is caught at activation instead of
after an invisible edit.

The endpoint is authoritative for "no" only. It reports the proxy's own
bind and knows nothing about the sandbox's, so a proxy-side match cannot
conclude aligned on its own — only `atlas workspace` compares both binds
and sees a SPLIT, the case where file tools read one tree while
run_command uses another and every health check stays green. A
proxy-side match therefore falls through to the CLI; only a proxy-side
mismatch short-circuits.

getWorkspace returns null rather than throwing on any failure. An older
proxy without the route, or one that is simply unreachable, must read as
"cannot tell" and fall through — a client must never nag a user whose
setup is fine.

covers() ports workspace.py's _covers: containment, not equality, so a
subdirectory of the bind is aligned. It resolves symlinks via realpath
and falls back to path.resolve when the path does not exist yet, which
keeps it testable without a real filesystem.
@Anuj-72
Anuj-72 requested a review from itigges22 as a code owner August 4, 2026 10:04
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