Skip to content

fix: workspace params - #266

Merged
pedronauck merged 5 commits into
mainfrom
fix-workspace
Jul 28, 2026
Merged

pedronauck merged 5 commits into
mainfrom
fix-workspace

Conversation

@pedronauck

@pedronauck pedronauck commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Workspace context can be inferred from the current directory, session identity, environment, or an ID, name, or path; CLI commands support optional workspace overrides.
    • Structured/JSON/TOON outputs now include workspace-resolution provenance (resolution_source).
    • Native tools and extensions consistently enforce workspace-scoped access.
  • Breaking Changes

    • Native/tool request payloads now use workspace instead of workspace_id.
    • Agent identity headers no longer include a workspace header; requests rely on session ID and agent name.

@pedronauck pedronauck self-assigned this Jul 28, 2026
@greptile-apps

greptile-apps Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Too many files changed for review. (506 files found, 100 file limit)

@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
compozy-site Ready Ready Preview, Comment Jul 28, 2026 5:29pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 410016ce-4bb0-4c95-9c8d-67eb40f29858

📥 Commits

Reviewing files that changed from the base of the PR and between be77bef and 6f42a8f.

⛔ Files ignored due to path filters (220)
  • .github/workflows/ci.yml is excluded by !**/*.yml
  • MIGRATION_GUIDE.md is excluded by !**/*.md
  • docs/_memory/lessons/L-033-workspace-resolution-is-a-boundary.md is excluded by !**/*.md
  • docs/_memory/lessons/README.md is excluded by !**/*.md
  • docs/qa/_seeds/final-qa/_children/02-config-settings.md is excluded by !**/*.md
  • docs/qa/_seeds/final-qa/_children/03-acp-sessions.md is excluded by !**/*.md
  • docs/qa/_seeds/final-qa/_children/11-api-cli-parity.md is excluded by !**/*.md
  • docs/qa/_seeds/final-qa/_children/12-web-ui.md is excluded by !**/*.md
  • docs/qa/journeys/J-operate-workspace-context.md is excluded by !**/*.md
  • docs/qa/scenarios/ET-compozy-extension-contract-identity.md is excluded by !**/*.md
  • docs/qa/scenarios/ET-native-workspace-scope-isolation.md is excluded by !**/*.md
  • docs/qa/scenarios/ET-workspace-host-api-mcp.md is excluded by !**/*.md
  • docs/qa/scenarios/MS-workspace-resolution-chain.md is excluded by !**/*.md
  • docs/qa/scenarios/MS-workspace-resolution-provenance.md is excluded by !**/*.md
  • internal/tools/builtin/testdata/native-tool-catalog.json is excluded by !**/*.json
  • openapi/compozy-daemon.json is excluded by !**/*.json
  • openapi/compozy.json is excluded by !**/*.json
  • packages/site/content/runtime/cli-reference/agent/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/duplicate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/history.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/inspect.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/rollback.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/validate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/wake.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/heartbeat/write.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/history.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/inspect.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/rollback.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/validate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/soul/write.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/agent/update.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/jobs/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/jobs/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/suggestions/accept.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/suggestions/dismiss.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/suggestions/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/triggers/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/automation/triggers/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/bridge/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/bridge/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/bundle/activate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/bundle/preview.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/check.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/edit.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/get.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/path.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/set.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/unset.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/config/validate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/clients/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/clients/register.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/clients/unregister.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/reorder.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/switch.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/desktop/update.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/hooks/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/hooks/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/hooks/runs.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout-profile/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout-profile/get.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout-profile/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout-profile/put.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/apply.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/arrange.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/balance.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/export.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/get.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/preview.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/redo.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/resize.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/undo.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/validate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/layout/watch.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/logs.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/approve.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/configure.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/edit.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/inspect.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/pause.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/resume.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/run.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/runs.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/stop.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/turns.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/loop/validate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/marketplace/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/marketplace/search.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/auth/login.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/auth/logout.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/auth/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/authorize.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/install.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/mcp/serve.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/adhoc/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/daily/ls.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/daily/restore.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/daily/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/decisions/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/delete.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/dream/trigger.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/edit.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/history.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/promote.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/reindex.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/reload.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/reset.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/scope-show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/search.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/write.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/channels/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/channels/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/channels/update.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/coordination/disable.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/coordination/enable.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/coordination/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/coordination/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/directs/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/directs/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/directs/messages.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/directs/resolve.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/directs/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/inbox.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/invitation/dismiss.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/invitation/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/invitation/reset.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/mute.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/peers.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/send.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/subscribe.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/subscriptions/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/subscriptions/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/threads/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/threads/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/threads/messages.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/threads/promote.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/threads/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/unmute.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/usage.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/work/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/work/lookup.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/network/work/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/observe/overview.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/resource/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/resource/put.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/roles/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/roles/show.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/scheduler/backlog.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/session/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/session/new.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/session/resume.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/disable.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/enable.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/inspect.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/view.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/skill/where.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/child/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/create.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/next.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/notification/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/notification/subscribe.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/task/promote.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/approvals/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/approvals/revoke.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/approvals/set.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/approve.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/artifact/read.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/invoke.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/tool/search.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/toolsets/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/toolsets/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/close.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/float.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/focus.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/move.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/navigate.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/open.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/swap.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/window/zoom.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/workspace/info.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/adding-a-bridge.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup-gchat.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup-github.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup-linear.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup-slack.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup-teams.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/bridges/setup.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/getting-started/installation.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/operations/mcp-serve.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/workspaces/multi-root.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/workspaces/resolver.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/migration/index.mdx is excluded by !**/*.mdx
  • skills/compozy/references/native-tools.md is excluded by !**/*.md
  • skills/compozy/references/runtime-operations.md is excluded by !**/*.md
  • web/src/generated/compozy-daemon-openapi.d.ts is excluded by !**/generated/**, !**/generated/**, !**/*.d.ts
  • web/src/generated/compozy-openapi.d.ts is excluded by !**/generated/**, !**/generated/**, !**/*.d.ts
📒 Files selected for processing (286)
  • Makefile
  • go.mod
  • internal/agentidentity/credentials.go
  • internal/agentidentity/identity.go
  • internal/agentidentity/identity_test.go
  • internal/api/core/agent_channels_internal_test.go
  • internal/api/core/agent_identity.go
  • internal/api/core/tasks.go
  • internal/api/core/tasks_internal_test.go
  • internal/api/spec/agent_identity_contract.go
  • internal/api/spec/operation_validation.go
  • internal/api/spec/operations.go
  • internal/api/spec/spec.go
  • internal/api/spec/spec_test.go
  • internal/api/udsapi/agent_channels_test.go
  • internal/api/udsapi/agent_identity_test.go
  • internal/automation/manager_definition_sync.go
  • internal/automation/manager_test.go
  • internal/bundles/service.go
  • internal/bundles/service_activation.go
  • internal/bundles/service_materialize_bridge.go
  • internal/bundles/service_resolution.go
  • internal/bundles/service_test.go
  • internal/cli/agent.go
  • internal/cli/agent_commands_test.go
  • internal/cli/agent_identity.go
  • internal/cli/agent_kernel_test.go
  • internal/cli/agent_mutate.go
  • internal/cli/agent_mutate_requests.go
  • internal/cli/api_state_verb_commands_test.go
  • internal/cli/authored_context.go
  • internal/cli/authored_context_heartbeat_commands.go
  • internal/cli/authored_context_session_commands.go
  • internal/cli/authored_context_test.go
  • internal/cli/automation.go
  • internal/cli/automation_job_create.go
  • internal/cli/automation_list_commands.go
  • internal/cli/automation_list_queries.go
  • internal/cli/automation_request.go
  • internal/cli/automation_run_commands.go
  • internal/cli/automation_suggestions.go
  • internal/cli/automation_test.go
  • internal/cli/automation_trigger_commands.go
  • internal/cli/bridge_list.go
  • internal/cli/bridge_mutation.go
  • internal/cli/bridge_test.go
  • internal/cli/bundle.go
  • internal/cli/bundle_activation_flags.go
  • internal/cli/bundle_test.go
  • internal/cli/client_bridge_list.go
  • internal/cli/client_test.go
  • internal/cli/client_transport.go
  • internal/cli/client_window_manager.go
  • internal/cli/client_workspace_authoring.go
  • internal/cli/command_paths_test.go
  • internal/cli/config_display.go
  • internal/cli/config_management_commands.go
  • internal/cli/config_test.go
  • internal/cli/config_value_commands.go
  • internal/cli/daemon_authored_context_test.go
  • internal/cli/flags.go
  • internal/cli/format.go
  • internal/cli/format_test.go
  • internal/cli/format_workspace_resolution.go
  • internal/cli/helpers_test.go
  • internal/cli/hooks.go
  • internal/cli/hooks_test.go
  • internal/cli/lifecycle_test.go
  • internal/cli/logs.go
  • internal/cli/loop.go
  • internal/cli/loop_list.go
  • internal/cli/loop_runs.go
  • internal/cli/loop_support.go
  • internal/cli/loop_test.go
  • internal/cli/marketplace.go
  • internal/cli/marketplace_test.go
  • internal/cli/mcp_auth.go
  • internal/cli/mcp_auth_test.go
  • internal/cli/mcp_install.go
  • internal/cli/mcp_install_test.go
  • internal/cli/mcp_serve.go
  • internal/cli/mcp_serve_test.go
  • internal/cli/memory.go
  • internal/cli/memory_decisions.go
  • internal/cli/memory_input.go
  • internal/cli/memory_list.go
  • internal/cli/memory_maintenance_commands.go
  • internal/cli/memory_runtime_commands.go
  • internal/cli/memory_test.go
  • internal/cli/network.go
  • internal/cli/network_public_surfaces_test.go
  • internal/cli/network_test.go
  • internal/cli/observe.go
  • internal/cli/observe_test.go
  • internal/cli/resource.go
  • internal/cli/roles.go
  • internal/cli/roles_test.go
  • internal/cli/scheduler.go
  • internal/cli/scheduler_test.go
  • internal/cli/session.go
  • internal/cli/session_create.go
  • internal/cli/session_event_output.go
  • internal/cli/session_list.go
  • internal/cli/session_test.go
  • internal/cli/skill_commands.go
  • internal/cli/skill_commands_mutation.go
  • internal/cli/skill_daemon_test.go
  • internal/cli/skill_info.go
  • internal/cli/skill_test.go
  • internal/cli/skill_workspace.go
  • internal/cli/task_agent_claim.go
  • internal/cli/task_agent_control.go
  • internal/cli/task_as_agent_test.go
  • internal/cli/task_commands_crud.go
  • internal/cli/task_commands_dependencies_runs.go
  • internal/cli/task_commands_notifications.go
  • internal/cli/task_list.go
  • internal/cli/task_parsing.go
  • internal/cli/task_test.go
  • internal/cli/tool_approvals.go
  • internal/cli/tool_approvals_test.go
  • internal/cli/tool_artifacts.go
  • internal/cli/tool_operator.go
  • internal/cli/tool_test.go
  • internal/cli/window_manager_common.go
  • internal/cli/window_manager_desktop.go
  • internal/cli/window_manager_layout.go
  • internal/cli/window_manager_layout_mutations.go
  • internal/cli/window_manager_layout_profile.go
  • internal/cli/window_manager_test.go
  • internal/cli/window_manager_window.go
  • internal/cli/window_manager_window_move.go
  • internal/cli/window_manager_window_navigate.go
  • internal/cli/workspace.go
  • internal/cli/workspace_resolution.go
  • internal/cli/workspace_test.go
  • internal/codegen/storeschema/sqlc.go
  • internal/codegen/storeschema/sqlc_test.go
  • internal/daemon/boot_tool_registry.go
  • internal/daemon/extension_manager_wiring.go
  • internal/daemon/hooks_bridge_extended_dispatch.go
  • internal/daemon/loop_action_policy.go
  • internal/daemon/loop_run_events_e2e_integration_test.go
  • internal/daemon/loop_runtime_adapters_test.go
  • internal/daemon/native_automation_list_tools.go
  • internal/daemon/native_automation_scope.go
  • internal/daemon/native_automation_suggestions.go
  • internal/daemon/native_automation_tool_input.go
  • internal/daemon/native_automation_tool_query.go
  • internal/daemon/native_automation_tools.go
  • internal/daemon/native_automation_tools_test.go
  • internal/daemon/native_automation_trigger_tools.go
  • internal/daemon/native_autonomy_claim_input.go
  • internal/daemon/native_bridge_catalog_tools.go
  • internal/daemon/native_bundle_resource_tools.go
  • internal/daemon/native_config_helpers.go
  • internal/daemon/native_config_hook_input.go
  • internal/daemon/native_config_hook_tools.go
  • internal/daemon/native_config_mutation_tools.go
  • internal/daemon/native_create_tools.go
  • internal/daemon/native_create_tools_test.go
  • internal/daemon/native_goal_tools.go
  • internal/daemon/native_hook_helpers.go
  • internal/daemon/native_hook_mutation_tools.go
  • internal/daemon/native_hook_query_tools.go
  • internal/daemon/native_loop_tools_support.go
  • internal/daemon/native_loop_tools_test.go
  • internal/daemon/native_memory_admin_mutation.go
  • internal/daemon/native_memory_admin_payload.go
  • internal/daemon/native_memory_admin_selector.go
  • internal/daemon/native_memory_admin_sessions.go
  • internal/daemon/native_memory_admin_tools.go
  • internal/daemon/native_network_list_tools.go
  • internal/daemon/native_network_message_tools.go
  • internal/daemon/native_network_usage.go
  • internal/daemon/native_session_list.go
  • internal/daemon/native_task_list.go
  • internal/daemon/native_task_notification_tools.go
  • internal/daemon/native_tool_approval_grants.go
  • internal/daemon/native_tool_approval_grants_test.go
  • internal/daemon/native_tool_authored_paths.go
  • internal/daemon/native_tool_memory_observe_input.go
  • internal/daemon/native_tool_network_session_input.go
  • internal/daemon/native_tool_observe_helpers.go
  • internal/daemon/native_tool_scope.go
  • internal/daemon/native_tool_task_input.go
  • internal/daemon/native_tool_window_manager_input.go
  • internal/daemon/native_tool_workspace_memory_calls.go
  • internal/daemon/native_tools.go
  • internal/daemon/native_tools_test.go
  • internal/daemon/native_workspace_input_binder.go
  • internal/daemon/notifier_test.go
  • internal/extension/capability_resource_policy.go
  • internal/extension/capability_test.go
  • internal/extension/host_api.go
  • internal/extension/host_api_automation.go
  • internal/extension/host_api_automation_binding.go
  • internal/extension/host_api_dispatch.go
  • internal/extension/host_api_task_query.go
  • internal/extension/host_api_test.go
  • internal/extension/host_api_workspace_binding.go
  • internal/extension/manager.go
  • internal/extension/manager_options.go
  • internal/extension/manager_runtime_launch.go
  • internal/extension/manager_test.go
  • internal/mcp/serve_binding.go
  • internal/mcp/serve_facade.go
  • internal/mcp/serve_projection.go
  • internal/mcp/serve_projection_decisions.go
  • internal/mcp/serve_test.go
  • internal/memory/consolidation/runtime.go
  • internal/memory/consolidation/runtime_test.go
  • internal/session/manager_prompt_input_event.go
  • internal/session/notifier.go
  • internal/session/repair_persistence.go
  • internal/session/session_stream_broadcast.go
  • internal/task/actors.go
  • internal/testutil/e2e/automation_tasks.go
  • internal/testutil/e2e/automation_tasks_test.go
  • internal/tools/builtin/authored_context.go
  • internal/tools/builtin/automation.go
  • internal/tools/builtin/automation_suggestions.go
  • internal/tools/builtin/autonomy.go
  • internal/tools/builtin/bridges.go
  • internal/tools/builtin/builtin_test.go
  • internal/tools/builtin/config.go
  • internal/tools/builtin/descriptors.go
  • internal/tools/builtin/hooks.go
  • internal/tools/builtin/loops.go
  • internal/tools/builtin/memory_admin.go
  • internal/tools/builtin/network.go
  • internal/tools/builtin/network_send_schema.go
  • internal/tools/builtin/network_usage.go
  • internal/tools/builtin/observe.go
  • internal/tools/builtin/sessions.go
  • internal/tools/builtin/skills.go
  • internal/tools/builtin/task_list_schema.go
  • internal/tools/builtin/task_mutation_schemas.go
  • internal/tools/builtin/task_network_schemas.go
  • internal/tools/builtin/tool_approvals.go
  • internal/tools/builtin/window_manager_schemas.go
  • internal/tools/builtin/workspace.go
  • internal/tools/dispatch.go
  • internal/tools/dispatch_hooks.go
  • internal/tools/dispatch_input_binding.go
  • internal/tools/dispatch_test.go
  • internal/tools/registry.go
  • internal/tools/tool.go
  • internal/workspace/discovery.go
  • internal/workspace/resolver.go
  • internal/workspace/resolver_crud.go
  • internal/workspace/resolver_test.go
  • magefiles/boundaries.go
  • magefiles/build.go
  • magefiles/codegen.go
  • magefiles/cross_build.go
  • magefiles/defaults.go
  • magefiles/deps_lint.go
  • magefiles/openapi_artifacts.go
  • magefiles/openapi_artifacts_test.go
  • magefiles/source_policy.go
  • magefiles/source_policy_integration.go
  • magefiles/source_policy_process.go
  • magefiles/source_policy_provider_env.go
  • magefiles/source_policy_test.go
  • magefiles/source_size.go
  • magefiles/verify.go
  • web/src/lib/__tests__/api-client.test.ts
  • web/src/lib/__tests__/daemon-api-contract.test.ts
  • web/src/lib/api-client.ts
  • web/src/lib/api-contract.ts
  • web/src/systems/tasks/adapters/__tests__/tasks-api-orchestration.test.ts
  • web/src/systems/tasks/adapters/task-context-api.ts
  • web/src/systems/tasks/hooks/__tests__/use-task-orchestration-hooks.test.tsx
  • web/src/systems/tasks/hooks/__tests__/use-task-orchestration-msw.test.tsx
  • web/src/systems/tasks/hooks/__tests__/use-task-stream.test.tsx
  • web/src/systems/tasks/hooks/use-task-context-bundle.ts
  • web/src/systems/tasks/hooks/use-task-profile.ts
  • web/src/systems/tasks/hooks/use-task-reviews.ts
  • web/src/systems/tasks/hooks/use-task-stream.ts
  • web/src/systems/tasks/index.ts
  • web/src/systems/tasks/lib/__tests__/query-keys.test.ts
  • web/src/systems/tasks/lib/__tests__/query-options.test.ts
  • web/src/systems/tasks/lib/query-keys.ts
  • web/src/systems/tasks/lib/query-options.ts
  • web/src/systems/tasks/types.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

This PR removes workspace ID from agent identity credentials/headers, replacing it with session-identity-derived workspace validation. It introduces a unified workspace resolution engine spanning CLI and daemon (positional/flag/env/session/cwd precedence), renames native tool JSON schema fields from workspace_id/workspace_root to workspace, adds a call-input binder to enforce trusted workspace scoping, extends Host API/MCP projections with workspace-bound parameter validation, adds new mage build/source-policy tooling, updates web task context queries to require explicit agent identity, and removes the secondary daemon OpenAPI client/types.

Changes

Workspace-Scoped Identity & Resolution

Layer / File(s) Summary
Agent identity credentials and workspace access validation
internal/agentidentity/*, internal/api/core/agent_identity.go, tasks.go, internal/api/spec/*, internal/api/udsapi/*, internal/daemon/loop_run_events_e2e_integration_test.go, internal/testutil/e2e/automation_tasks*.go
Credentials.WorkspaceID and the X-Compozy-Workspace-ID header are removed; ValidateWorkspaceAccess validates a resolved session workspace against an expected workspace ref, and adds applyAgentIdentityContract/operation registry validation.
Workspace resolver package
internal/workspace/discovery.go, resolver*.go, internal/bundles/*, internal/automation/manager_definition_sync.go, internal/memory/consolidation/runtime.go
Adds nearest-enclosing-workspace discovery with registration serialization; several callers switch from auto-registering ResolveOrRegister to read-only Resolve.
CLI workspace resolution engine
internal/cli/workspace_resolution.go, workspace.go, client_workspace_authoring.go, format*.go, helpers_test.go, client_test.go
Centralizes workspace resolution by ID/name/path/session/cwd, records resolution_source provenance, and canonicalizes nearest-route lookup for CLI commands.
CLI command wiring
internal/cli/agent*.go, automation*.go, bridge*.go, config*.go, hooks*.go, loop*.go, marketplace*.go, mcp_*.go, memory*.go, network*.go, observe*.go, resource.go, roles*.go, scheduler*.go, session*.go, skill*.go, task*.go, tool*.go, window_manager*.go and tests
Dozens of commands and their --workspace flags now resolve via the new engine instead of requiring/validating raw workspace IDs directly.
Tool dispatch call-input binder
internal/tools/dispatch*.go, registry.go, tool.go
Adds a CallInputBinder interface invoked before/after pre-call hooks to rewrite trusted scope into tool call input.
Native tool schema field rename
internal/daemon/native_*.go, internal/tools/builtin/*.go
Renames workspace_id/workspace_root to workspace across native tool input schemas and adds nativeWorkspaceInputBinder to resolve/validate the field.
Daemon automation caller-workspace scoping
internal/daemon/native_automation_*.go
Adds workspace-scoped job/trigger/run lookup helpers enforcing caller workspace filtering for automation tools.
Extension Host API workspace-bound scoping
internal/extension/host_api_*.go, manager*.go, capability_*.go
Adds a workspace-binding registry, validates/rewrites Host API params by binding type, and scopes extension resource sessions to their owning workspace.
MCP Host API projection binding
internal/mcp/serve_*.go
Reuses extension binding constants, resolving/validating workspace fields before invoking projected Host API tools.
Session/task notifier workspace derivation
internal/daemon/hooks_bridge_extended_dispatch.go, notifier_test.go, internal/session/*.go, internal/task/actors.go
Routes agent-event notifications through resolved session info and refuses hook dispatch without workspace identity.

Estimated code review effort: 5 (Critical) | ~180 minutes

Web Task Agent Context Identity

Layer / File(s) Summary
AgentContextIdentity type and query wiring
web/src/systems/tasks/types.ts, lib/query-keys.ts, lib/query-options.ts, adapters/task-context-api.ts, index.ts
Adds AgentContextIdentity and requires it for agent-context query keys/options and the fetch adapter's identity headers.
Hooks, invalidation, and tests
web/src/systems/tasks/hooks/use-task-context-bundle.ts, use-task-profile.ts, use-task-reviews.ts, use-task-stream.ts, tests
Updates hooks to accept identity and switches cache invalidation to the agentContextsRoot key.

Estimated code review effort: 2 (Simple) | ~15 minutes

Daemon Web OpenAPI Client Removal

Layer / File(s) Summary
Remove daemonApiClient and artifacts
web/src/lib/api-client.ts, api-contract.ts, tests, magefiles/defaults.go
Removes the secondary daemonApiClient/DaemonOperation* types and daemon OpenAPI artifact generation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Build Tooling, Source Policy Enforcement & SQLC Registry

Layer / File(s) Summary
Makefile and go.mod entries
Makefile, go.mod
Adds deps-check, source-policy, source-size, cross-build-windows targets and promotes pflag to direct.
Source policy static analysis
magefiles/source_policy*.go
Adds AST-based checks for integration build tags, provider-home env mutations, and process-control restrictions, with a SourcePolicy mage task and tests.
Source size and dependency checks
magefiles/source_size.go, deps_lint.go, boundaries.go, verify.go, build.go
Adds SourceSize/DepsCheck tasks wired into lint/verify, and removes the inline production-line-limit check from Boundaries.
Windows cross-build
magefiles/cross_build.go
Adds WindowsSubprocessBuild cross-compiling boundary packages for Windows.
OpenAPI artifact validation
magefiles/openapi_artifacts*.go, codegen.go, defaults.go
Validates registered OpenAPI spec/output artifact paths and wires validated lists into codegen.
SQLC package registry validation
internal/codegen/storeschema/sqlc*.go
Validates that registered SQLC packages exactly match discovered sqlc.yaml directories.

Estimated code review effort: 3 (Moderate) | ~30 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.60% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR’s main theme of changing workspace parameter handling across CLI, daemon, and API contracts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-workspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 6f42a8f.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
internal/daemon/notifier_test.go (1)

250-255: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that the hook callback was not invoked.

gotSessionID == "" does not prove dispatch was skipped; a dispatched callback with an empty session ID would pass this test. Track a separate hookCalled boolean and assert it remains false.

As per path instructions, tests must verify behavior outcomes rather than only relying on weak indirect assertions.

Also applies to: 283-285

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/notifier_test.go` around lines 250 - 255, Strengthen the
notifier test around fakeHookRuntime by adding a separate hookCalled flag set
inside onToolPreCall, then assert that it remains false after dispatch. Keep
gotSessionID assertions only for validating payload data; do not use an empty
session ID as evidence that the callback was skipped.

Source: Path instructions

internal/api/core/agent_identity.go (1)

28-43: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not report an unknown workspace reference as HTTP 500.

ErrWorkspaceNotFound is wrapped at Line 137 but has no status mapping, so it reaches the default 500 branch. Map it to the intended client error (normally 404) and cover that response.

Also applies to: 135-137

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/api/core/agent_identity.go` around lines 28 - 43, Update
StatusForAgentIdentityError to map workspacepkg.ErrWorkspaceNotFound to the
intended client-error status, typically http.StatusNotFound, instead of the
default 500 response. Add or update coverage for the wrapped unknown-workspace
error path around the caller at lines 135-137 and verify it returns 404.
internal/daemon/native_tool_approval_grants_test.go (1)

119-123: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Assert the specific denial envelope for the renamed field.

This test only checks errors.Is(err, ErrToolDenied). Add an errors.As assertion for *toolspkg.ToolError and verify the error text or reason identifies the workspace scope mismatch; otherwise an unrelated denial would make this regression pass.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_tool_approval_grants_test.go` around lines 119 - 123,
Strengthen the denial assertion in the workspace-override test by extracting the
error with errors.As into *toolspkg.ToolError, then verify its message or reason
identifies the workspace scope mismatch. Keep the existing errors.Is(err,
toolspkg.ErrToolDenied) assertion while ensuring unrelated denials cannot
satisfy the regression.

Source: Path instructions

internal/daemon/native_create_tools.go (1)

246-253: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Persist the requested workspace, not the caller scope.

createReq.Workspace now contains the selected target workspace, including operator requests, but agentCreate still stores scope.WorkspaceID in the catalog entry. An operator targeting another workspace can therefore create an agent with an empty or incorrect workspace binding.

Use createReq.Workspace for entry.WorkspaceID and add a test targeting a workspace different from scope.WorkspaceID. (raw.githubusercontent.com)

Proposed fix
-		entry.WorkspaceID = strings.TrimSpace(scope.WorkspaceID)
+		entry.WorkspaceID = strings.TrimSpace(createReq.Workspace)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_create_tools.go` around lines 246 - 253, Update
agentCreate so the catalog entry’s entry.WorkspaceID is populated from the
resolved createReq.Workspace rather than scope.WorkspaceID, preserving the
selected target workspace for operator requests. Add a test covering an operator
targeting a workspace different from scope.WorkspaceID and assert the created
agent stores the requested workspace.
internal/cli/task_list.go (1)

105-112: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

--scope all bypasses the new workspace-resolution engine.

When scopeRaw is "all" (taskpkg.CatalogScopeAll), resolveTaskScopeWorkspace fails validation before ever calling resolveCommandWorkspace (since taskpkg.Scope.Validate only accepts global/workspace). The catch block here then falls back to the raw, unresolved workspaceRef instead of resolving it. Every other scope path in this PR now resolves --workspace by ID/name/path through the new engine, but task list --scope all --workspace <name-or-path> will silently pass the raw name/path straight into TaskListQuery.Workspace, producing incorrect filtering.

🐛 Proposed fix
 	scope, workspace, err := resolveTaskScopeWorkspace(cmd, deps, client, scopeRaw, workspaceRef, false)
 	if err != nil {
 		if strings.TrimSpace(strings.ToLower(scopeRaw)) != string(taskpkg.CatalogScopeAll) {
 			return TaskListQuery{}, err
 		}
 		scope = ""
-		workspace = strings.TrimSpace(workspaceRef)
+		workspace = strings.TrimSpace(workspaceRef)
+		if workspace != "" {
+			resolution, resolveErr := resolveCommandWorkspace(
+				cmd.Context(),
+				cmd,
+				deps,
+				client,
+				workspaceResolutionRequest{FlagRef: workspace},
+			)
+			if resolveErr != nil {
+				return TaskListQuery{}, resolveErr
+			}
+			workspace = resolution.ID
+		}
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/task_list.go` around lines 105 - 112, The --scope all error path
assigns the raw workspaceRef without resolving it. Update the scope-all handling
around resolveTaskScopeWorkspace to resolve workspaceRef through the existing
workspace-resolution engine, such as resolveCommandWorkspace, and assign its
canonical workspace value to TaskListQuery.Workspace while preserving the
current empty-scope behavior.
🧹 Nitpick comments (14)
internal/daemon/native_automation_tools_test.go (1)

481-516: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer t.Errorf + a returned error inside the stub callbacks.

t.Fatalf from ListJobsFn/GetJobFn/ListRunsFn only behaves correctly if the registry invokes these on the test goroutine; if dispatch ever moves to a worker goroutine the failure is silently mis-reported instead of failing the test. Returning a sentinel error after t.Errorf keeps the assertion goroutine-safe and also produces a clearer failure at the call site.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_automation_tools_test.go` around lines 481 - 516,
Replace t.Fatalf calls in the ListJobsFn, GetJobFn, and ListRunsFn stubs with
t.Errorf followed by returning an appropriate sentinel error, preserving the
existing successful return values otherwise. Apply the same goroutine-safe
callback behavior to the related GetTriggerFn and GetRunFn stubs if they use the
same assertion pattern, so failures propagate to the registry call site.
internal/daemon/native_automation_tool_query.go (1)

13-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated job_id/trigger_id/workspace between the outer structs and the embedded automationRunQueryInput.

automationJobHistoryInput declares JobID/WorkspaceID while also embedding automationRunQueryInput, which declares the same JSON keys. Go's shallower-field rule makes the outer fields win at decode time, so the embedded copies are always zero — including inside the promoted query() method. The handlers work today only because they overwrite query.JobID/query.TriggerID afterwards and read the outer WorkspaceID, but any future reader of the embedded values silently gets an empty string.

Dropping the outer duplicates (and reading input.automationRunQueryInput values) or dropping the promoted fields from the embedded struct would remove the shadowing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_automation_tool_query.go` around lines 13 - 33, Remove
the duplicated JobID, TriggerID, and WorkspaceID fields between
automationJobHistoryInput, automationTriggerHistoryInput, and
automationRunQueryInput so JSON decoding cannot shadow embedded values. Update
the affected handlers and promoted query() usage to read the retained
automationRunQueryInput fields, while preserving each input’s required
identifier behavior.
internal/extension/host_api_workspace_binding.go (2)

28-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Alias block duplicates every exported constant.

hostAPIWorkspaceBinding and the eight lowercase aliases add a second name for each value with no added meaning; the exported identifiers are usable directly inside the package.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/extension/host_api_workspace_binding.go` around lines 28 - 40,
Remove the redundant hostAPIWorkspaceBinding type alias and the lowercase
constant aliases in the alias block, including hostAPIWorkspaceScopeKindKey.
Update any references to use the original exported HostAPIWorkspaceBinding type
and constants directly within the package.

224-319: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Duplicated workspace-binding semantics across extensionpkg and mcp. Both packages implement the same reference canonicalization, scope-literal binding, and resource-scope validation against a bound workspace, and the copies are already drifting (blank scope.id handling differs). internal/mcp already imports extensionpkg for HostAPIWorkspaceBindingFor, so the binder itself can have a single owner.

  • internal/extension/host_api_workspace_binding.go#L224-L319: export a resolver-parameterized binder (e.g. BindWorkspaceScopedParams(ctx, binding, raw, workspaceID, workspaceRoot, resolver)) that both callers can share, keeping the RPC-error wrapping at the handler layer.
  • internal/mcp/serve_binding.go#L88-L201: replace bindWorkspaceString/bindString/bindResourceScope/validateResourceScope with calls into that exported binder so MCP and Host API can no longer diverge.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/extension/host_api_workspace_binding.go` around lines 224 - 319,
Centralize workspace-binding behavior by exporting a resolver-parameterized
binder from internal/extension/host_api_workspace_binding.go, covering reference
canonicalization, scope-literal binding, and resource-scope validation while
preserving RPC-error wrapping in the handler layer. Update
internal/mcp/serve_binding.go to replace bindWorkspaceString, bindString,
bindResourceScope, and validateResourceScope with calls to the shared binder;
both sites must use identical blank scope.id handling and resolver behavior.
internal/extension/host_api_test.go (1)

256-256: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inner table subtests omit t.Parallel().

All the cases are read-only or expected-to-fail calls against the shared env, so they can run in parallel like the enclosing suites do. As per coding guidelines, "Go tests must use Should … subtest names, default to t.Parallel".

♻️ Proposed change
 			t.Run(tc.name, func(t *testing.T) {
+				t.Parallel()
 				_, missingErr := env.callWithContext(ctx, t, extensionName, tc.method, tc.missingParams)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/extension/host_api_test.go` at line 256, Update the inner
table-driven subtest launched by t.Run in the host API tests to call
t.Parallel() at the start of its callback. Preserve the existing test cases and
enclosing-suite behavior while ensuring each read-only or expected-failure case
uses the required parallel execution pattern.

Source: Coding guidelines

internal/extension/host_api_automation_binding.go (1)

25-45: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Full list-pagination scan for a single-ID lookup.

Each bound job/trigger lookup pages through every automation record in the workspace just to match one ID, and requireBoundAutomationRunFilter can trigger two such scans per automation/runs call. A direct GetJob/GetTrigger followed by a workspace-ID comparison is O(1) and preserves the "hide as not-found" parity the tests assert.

♻️ Sketch of the direct-lookup alternative
-	query := automationpkg.JobListQuery{
-		Scope:       automationpkg.AutomationScopeWorkspace,
-		WorkspaceID: strings.TrimSpace(boundWorkspaceID),
-		Limit:       automationpkg.MaxListLimit,
-	}
-	for {
-		page, listErr := automation.ListJobs(ctx, query)
-		if listErr != nil {
-			return automationpkg.Job{}, listErr
-		}
-		for _, job := range page.Jobs {
-			if strings.TrimSpace(job.ID) == jobID {
-				return job, nil
-			}
-		}
-		if !page.HasMore || strings.TrimSpace(page.NextCursor) == "" {
-			return automationpkg.Job{}, automationpkg.ErrJobNotFound
-		}
-		query.Cursor = page.NextCursor
-	}
+	job, err := automation.GetJob(ctx, jobID)
+	if err != nil {
+		return automationpkg.Job{}, err
+	}
+	if strings.TrimSpace(job.WorkspaceID) != strings.TrimSpace(boundWorkspaceID) {
+		return automationpkg.Job{}, automationpkg.ErrJobNotFound
+	}
+	return job, nil
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/extension/host_api_automation_binding.go` around lines 25 - 45,
Replace the paginated single-ID lookup loop with a direct GetJob/GetTrigger call
in the bound automation lookup helpers, then compare the returned resource’s
workspace ID with the bound workspace ID. Convert lookup errors or workspace
mismatches to the existing not-found behavior, preserving the hidden-resource
semantics and avoiding repeated full workspace scans from
requireBoundAutomationRunFilter.
internal/daemon/native_tool_workspace_memory_calls.go (1)

30-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Wrap the resolver error so workspace_list returns a typed tool error.

Every other native workspace path (nativeResolvedWorkspace) maps resolver failures through nativeNetworkInputError, producing a ToolError with a code/reason. Here the raw Resolve error escapes, so a scoped caller whose workspace can't be resolved gets an untyped failure.

♻️ Suggested change
 	if !scope.Operator && strings.TrimSpace(scope.WorkspaceID) != "" {
 		resolved, err := n.deps.Workspaces.Resolve(ctx, scope.WorkspaceID)
 		if err != nil {
-			return toolspkg.ToolResult{}, err
+			return toolspkg.ToolResult{}, nativeNetworkInputError(req.ToolID, err)
 		}
 		workspaces = []workspacepkg.Workspace{resolved.Workspace}
 	} else {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_tool_workspace_memory_calls.go` around lines 30 - 42,
Update the Resolve error handling in the scoped branch of native workspace
listing to pass the resolver failure through nativeNetworkInputError before
returning it. Preserve the existing successful resolution and List error
behavior so workspace_list returns a typed ToolError with the expected code and
reason for resolution failures.
internal/cli/client_workspace_authoring.go (1)

84-115: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Nearest-enclosing algorithm duplicated with a different tie-break vs. internal/workspace/discovery.go.

See consolidated comment for details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/client_workspace_authoring.go` around lines 84 - 115, Replace
the duplicated selection logic in nearestCLIWorkspaceRoute with the existing
nearest-enclosing workspace algorithm from internal/workspace/discovery.go,
including its tie-breaking behavior. Reuse the shared implementation or extract
a common helper so CLI and discovery consistently select the same workspace
while preserving path canonicalization and invalid-entry handling.
internal/workspace/discovery.go (1)

12-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Nearest-enclosing algorithm duplicated with a different tie-break in the CLI package.

See consolidated comment for details (shared with internal/cli/client_workspace_authoring.go).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/workspace/discovery.go` around lines 12 - 59, Replace the duplicated
nearest-enclosing workspace selection logic in
Resolver.lookupWorkspaceByEnclosingRoot with the consolidated shared algorithm
used by the CLI workspace-authoring flow. Ensure both callers use the same root
matching, depth comparison, and tie-breaking behavior, removing the local
implementation rather than maintaining a second variant.
internal/daemon/loop_runtime_adapters_test.go (1)

207-235: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the positive outcome, not just the absence of ResolveOrRegister.

The subtest discards applyResolved's result, so it would still pass if applyResolved degraded into a no-op. Assert the resolved workspace identity/policy actually landed on the CreateOpts (e.g. Workspace, SandboxRef, or Permissions) alongside the resolveOrRegisterCalled check.

As per path instructions, "Verify tests can fail when business logic changes" and "Ensure tests verify behavior outcomes, not just function calls".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/loop_runtime_adapters_test.go` around lines 207 - 235, Update
the “Should resolve a registered workspace path without registering it” subtest
to retain the CreateOpts passed to policyGate.applyResolved and assert that the
registered workspace’s identity or policy fields, such as Workspace, SandboxRef,
or Permissions, are applied. Keep the existing resolveOrRegisterCalled assertion
to verify registration is not invoked.

Source: Path instructions

internal/automation/manager_definition_sync.go (1)

284-294: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Leftover if/else after dropping the resolution-mode parameter. In both files the two branches now invoke Resolve identically; only the ref (normalized path vs. trimmed ref) differs, so the branch can be reduced to computing the ref followed by one Resolve call.

  • internal/automation/manager_definition_sync.go#L284-L294: compute ref (normalized when path-like, keeping the automation: resolve config workspace %q wrapping) and call m.workspaceResolver.Resolve(ctx, ref) once.
  • internal/bundles/service_materialize_bridge.go#L106-L116: compute ref (normalized when path-like) and call s.workspaceResolver.Resolve(ctx, ref) once.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/automation/manager_definition_sync.go` around lines 284 - 294, The
workspace resolution branches duplicate the resolver call after removal of the
resolution-mode parameter. In internal/automation/manager_definition_sync.go
lines 284-294, compute a single ref from trimmedRef, normalize path-like
references while preserving the existing wrapped error, then call
m.workspaceResolver.Resolve(ctx, ref) once; apply the same ref computation and
single s.workspaceResolver.Resolve(ctx, ref) call in
internal/bundles/service_materialize_bridge.go lines 106-116.
internal/cli/workspace_test.go (1)

433-488: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a case where the session lookup itself fails.

These cases cover a successful identity lookup that mismatches, but not the branch where resolveAgentCallerFromEnv returns an error while COMPOZY_SESSION_ID/COMPOZY_AGENT are set. That branch currently fails open (see the comment on internal/cli/workspace_resolution.go Lines 305-328), and a getSessionFn returning an error here would pin the intended behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/workspace_test.go` around lines 433 - 488, Extend the
table-driven tests in the workspace identity validation block with a case where
the configured session lookup fails, using getSessionFn to return a sentinel
error while COMPOZY_SESSION_ID and COMPOZY_AGENT remain set. Assert that
executeRootCommand returns that lookup error rather than proceeding or returning
success, covering the resolveAgentCallerFromEnv error branch.

Source: Path instructions

internal/cli/agent_mutate_requests.go (1)

66-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse the shared workspace-override resolver instead of re-inlining it four times. authored_context.go already extracts the exact commandWorkspaceFlag(cmd) → resolveOptionalWorkspaceOverride(...) sequence into resolveAuthoredContextWorkspace; these four sites duplicate it verbatim instead of calling a shared (ideally more generically named) helper.

  • internal/cli/agent_mutate_requests.go#L66-L76: replace the inline two-step resolution in createAgentRequestFromFlags with a call to the shared helper.
  • internal/cli/agent_mutate_requests.go#L175-L184: replace the inline resolution in duplicateAgentRequestFromFlags's else branch with the same shared helper.
  • internal/cli/agent_mutate.go#L66-L79: replace the inline resolution in newAgentUpdateCommand with the shared helper, and give the two error-wrap messages distinct text so failures in flag parsing vs. override resolution can be told apart.
  • internal/cli/agent_mutate.go#L117-L134: replace the inline resolution in newAgentDeleteCommand with the shared helper, with the same distinct error-wrap fix.
♻️ Suggested direction
-workspaceRef, err := commandWorkspaceFlag(cmd)
-if err != nil {
-    return fmt.Errorf("cli: resolve update workspace: %w", err)
-}
-workspace, err := resolveOptionalWorkspaceOverride(
-    cmd.Context(),
-    cmd,
-    deps,
-    client,
-    workspaceRef,
-)
-if err != nil {
-    return fmt.Errorf("cli: resolve update workspace: %w", err)
-}
+workspace, err := resolveAuthoredContextWorkspace(cmd, deps, client)
+if err != nil {
+    return fmt.Errorf("cli: resolve update workspace: %w", err)
+}

(move/rename resolveAuthoredContextWorkspace to a shared file if it should no longer be authored-context-specific)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/agent_mutate_requests.go` around lines 66 - 76, Replace the
duplicated commandWorkspaceFlag-to-resolveOptionalWorkspaceOverride sequences
with one shared, generically named helper based on
resolveAuthoredContextWorkspace. In
internal/cli/agent_mutate_requests.go#L66-L76 and `#L175-L184`, update
createAgentRequestFromFlags and duplicateAgentRequestFromFlags; in
internal/cli/agent_mutate.go#L66-L79 and `#L117-L134`, update
newAgentUpdateCommand and newAgentDeleteCommand. For the latter two sites, give
flag-parsing and workspace-override error wrappers distinct messages.
internal/cli/mcp_serve_test.go (1)

13-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add real-function coverage for the workspace-resolution path.

The new subtest only checks that newMCPServeCommand dispatches into a stubbed runMCPServe; it doesn't exercise the actual runMCPServe workspace-resolution logic (the resolveCommandWorkspace(ctx, nil, ...) call). The other real-function tests bail out on transport validation before reaching that code. Consider adding a test that stubs the daemon/workspace-lookup client and asserts runMCPServe resolves a workspace via cwd/session/env when --workspace is omitted.

As per path instructions, "MUST test meaningful business logic, not trivial operations" and tests should "verify tests can fail when business logic changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/mcp_serve_test.go` around lines 13 - 28, Add a real-function
test that invokes runMCPServe rather than only the stubbed callback in
newMCPServeCommand, with --workspace omitted. Stub the daemon/workspace lookup
client and configure cwd, session, or environment inputs so
resolveCommandWorkspace receives nil workspace and resolves the expected
workspace; assert the resolved value reaches the serve flow, ensuring the test
fails if workspace-resolution behavior changes.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/api/core/agent_identity.go`:
- Around line 135-143: Update the workspace resolution flow around
Workspaces.Get to call the resolver’s Resolve method and use
ResolvedWorkspace.WorkspaceID as the canonical identity before authorization.
Trim and validate that WorkspaceID is non-empty, preserving the existing error
behavior, and add a test covering differing registration and identity IDs.

In `@internal/cli/marketplace.go`:
- Around line 45-49: Move the local --cursor/--kind validation in the
marketplace command ahead of clientFromDeps and readScope.resolve, including the
--scope workspace case so --cursor without --kind returns the argument error
before workspace resolution. Add a test covering workspace scope with --cursor
page-two and no --kind.

In `@internal/cli/session_event_output.go`:
- Around line 140-146: Update the resolveWorkspaceCandidate call in the session
event output flow to attribute --cwd-derived workspace resolution to
workspaceResolutionCWD instead of workspaceResolutionFlag. Keep the existing
discovery fallback behavior and ensure emitted resolution_source values
consistently represent path-derived workspace provenance.
- Around line 147-160: Update the resolution handling around
workspaceRefFromSessionIdentity and validateResolutionAgainstSessionIdentity so
only errors accepted by workspaceResolutionAllowsGlobalFallback permit the
existing raw --cwd fallback. For all other resolution failures, propagate the
error instead of recording workspaceResolutionFlag or returning the unvalidated
cleaned path; retain identity validation for successful resolutions and the
existing benign 404/path-not-registered fallback.

In `@internal/cli/workspace_resolution.go`:
- Around line 305-328: Update workspaceRefFromSessionIdentity to distinguish
missing credentials from failed session validation: preserve the empty identity
result only when SessionID or AgentName is absent, but propagate
resolveAgentCallerFromEnv errors for configured identities. Adjust its return
contract and validateResolutionAgainstSessionIdentity so lookup failures do not
disable workspace scoping or allow caller-supplied workspace references through.

In `@internal/cli/workspace.go`:
- Around line 153-159: Define a dedicated workspace flag-name constant and use
it consistently: update internal/cli/workspace.go lines 153-159 to register the
flag via that constant instead of workspaceSkillSource, and update
internal/cli/workspace_resolution.go lines 175-181 to pass the same constant to
cmd.Flags().Lookup instead of the hardcoded string. Preserve explicit-blank
--workspace detection.

In `@internal/daemon/native_automation_scope.go`:
- Around line 101-136: Replace the workspace-wide enumeration in
nativeAutomationRunForWorkspace with a direct run-by-ID lookup, then validate
that the returned run’s JobID and TriggerID resolve to jobs/triggers owned by
workspaceID; return ErrRunNotFound for absent or foreign runs. Apply the same
point-lookup and ownership-validation approach to
nativeAutomationJobForWorkspace and nativeAutomationTriggerForWorkspace instead
of paging through full workspace listings, while preserving existing behavior
when workspaceID is empty.
- Around line 16-20: The workspace-scoped automation paths fail open when
workspaceID is blank. In internal/daemon/native_automation_scope.go at lines
16-20, 63-65, and 108-110, and
internal/daemon/native_automation_trigger_tools.go at lines 262-276, confirm
workspace-bound callers always populate workspace or return a deterministic
not-found/denied error instead of delegating to unscoped GetJob, GetTrigger,
GetRun, or run-listing operations.
- Around line 43-53: Update the pagination loop in the jobs-listing method
around automationManager().ListJobs to return when HasMore is true but
NextCursor equals the current query.Cursor, preventing repeated requests and
duplicate accumulation. Apply the same cursor-progress guard to the trigger
pagination loop around its corresponding ListJobs flow, while preserving normal
pagination when the cursor advances.

In `@internal/daemon/native_workspace_input_binder.go`:
- Around line 172-186: Update resolveNativeWorkspaceInput to fail closed when b
is nil or b.workspaces is nil instead of calling setNativeWorkspaceInput with
the unresolved ref. Return nativeNetworkInputError(id,
workspacepkg.ErrWorkspaceResolverUnavailable), matching the existing
nativeWorkspaceRoot behavior, while preserving the normal resolver and
resolved-ID path.
- Around line 28-59: Move the global-scope authorization out of the
ToolsetIDAutomation-only guard in BindCallInput and enforce it generically for
every native descriptor that accepts workspace input. Ensure non-operator
callers with a trusted scope cannot submit scope:"global" or "all" without an
explicit workspace, while preserving operator and untrusted-scope behavior and
the existing bindNativeWorkspaceNode flow.

In `@internal/mcp/serve_binding.go`:
- Around line 183-193: Update the scope validation in the workspace-binding flow
before workspaces.Resolve is called: after trimming id, reject an empty id with
the existing scope-conflict error. Preserve the direct workspaceID match and
ensure blank scope.id values never reach Resolve.

In `@internal/workspace/resolver_crud.go`:
- Around line 348-376: Update lookupWorkspaceBySameRoot to detect os.ErrNotExist
from canonicalRoot or os.Stat(canonicalPath) before scanning registered
workspaces, and return the existing ErrWorkspaceNotFound/root-missing outcome
instead of propagating a generic stat error. Preserve the current
registered-workspace scanning behavior for paths that exist.

In `@web/src/systems/tasks/hooks/__tests__/use-task-orchestration-hooks.test.tsx`:
- Around line 269-291: Update the tests for useAgentContext and
useTaskContextBundle to assert that the first getAgentContext call receives the
expected identity object. Keep the existing result assertions and call-count
check, ensuring both hooks verify identity propagation without relying only on
the mock’s resolved value.

---

Outside diff comments:
In `@internal/api/core/agent_identity.go`:
- Around line 28-43: Update StatusForAgentIdentityError to map
workspacepkg.ErrWorkspaceNotFound to the intended client-error status, typically
http.StatusNotFound, instead of the default 500 response. Add or update coverage
for the wrapped unknown-workspace error path around the caller at lines 135-137
and verify it returns 404.

In `@internal/cli/task_list.go`:
- Around line 105-112: The --scope all error path assigns the raw workspaceRef
without resolving it. Update the scope-all handling around
resolveTaskScopeWorkspace to resolve workspaceRef through the existing
workspace-resolution engine, such as resolveCommandWorkspace, and assign its
canonical workspace value to TaskListQuery.Workspace while preserving the
current empty-scope behavior.

In `@internal/daemon/native_create_tools.go`:
- Around line 246-253: Update agentCreate so the catalog entry’s
entry.WorkspaceID is populated from the resolved createReq.Workspace rather than
scope.WorkspaceID, preserving the selected target workspace for operator
requests. Add a test covering an operator targeting a workspace different from
scope.WorkspaceID and assert the created agent stores the requested workspace.

In `@internal/daemon/native_tool_approval_grants_test.go`:
- Around line 119-123: Strengthen the denial assertion in the workspace-override
test by extracting the error with errors.As into *toolspkg.ToolError, then
verify its message or reason identifies the workspace scope mismatch. Keep the
existing errors.Is(err, toolspkg.ErrToolDenied) assertion while ensuring
unrelated denials cannot satisfy the regression.

In `@internal/daemon/notifier_test.go`:
- Around line 250-255: Strengthen the notifier test around fakeHookRuntime by
adding a separate hookCalled flag set inside onToolPreCall, then assert that it
remains false after dispatch. Keep gotSessionID assertions only for validating
payload data; do not use an empty session ID as evidence that the callback was
skipped.

---

Nitpick comments:
In `@internal/automation/manager_definition_sync.go`:
- Around line 284-294: The workspace resolution branches duplicate the resolver
call after removal of the resolution-mode parameter. In
internal/automation/manager_definition_sync.go lines 284-294, compute a single
ref from trimmedRef, normalize path-like references while preserving the
existing wrapped error, then call m.workspaceResolver.Resolve(ctx, ref) once;
apply the same ref computation and single s.workspaceResolver.Resolve(ctx, ref)
call in internal/bundles/service_materialize_bridge.go lines 106-116.

In `@internal/cli/agent_mutate_requests.go`:
- Around line 66-76: Replace the duplicated
commandWorkspaceFlag-to-resolveOptionalWorkspaceOverride sequences with one
shared, generically named helper based on resolveAuthoredContextWorkspace. In
internal/cli/agent_mutate_requests.go#L66-L76 and `#L175-L184`, update
createAgentRequestFromFlags and duplicateAgentRequestFromFlags; in
internal/cli/agent_mutate.go#L66-L79 and `#L117-L134`, update
newAgentUpdateCommand and newAgentDeleteCommand. For the latter two sites, give
flag-parsing and workspace-override error wrappers distinct messages.

In `@internal/cli/client_workspace_authoring.go`:
- Around line 84-115: Replace the duplicated selection logic in
nearestCLIWorkspaceRoute with the existing nearest-enclosing workspace algorithm
from internal/workspace/discovery.go, including its tie-breaking behavior. Reuse
the shared implementation or extract a common helper so CLI and discovery
consistently select the same workspace while preserving path canonicalization
and invalid-entry handling.

In `@internal/cli/mcp_serve_test.go`:
- Around line 13-28: Add a real-function test that invokes runMCPServe rather
than only the stubbed callback in newMCPServeCommand, with --workspace omitted.
Stub the daemon/workspace lookup client and configure cwd, session, or
environment inputs so resolveCommandWorkspace receives nil workspace and
resolves the expected workspace; assert the resolved value reaches the serve
flow, ensuring the test fails if workspace-resolution behavior changes.

In `@internal/cli/workspace_test.go`:
- Around line 433-488: Extend the table-driven tests in the workspace identity
validation block with a case where the configured session lookup fails, using
getSessionFn to return a sentinel error while COMPOZY_SESSION_ID and
COMPOZY_AGENT remain set. Assert that executeRootCommand returns that lookup
error rather than proceeding or returning success, covering the
resolveAgentCallerFromEnv error branch.

In `@internal/daemon/loop_runtime_adapters_test.go`:
- Around line 207-235: Update the “Should resolve a registered workspace path
without registering it” subtest to retain the CreateOpts passed to
policyGate.applyResolved and assert that the registered workspace’s identity or
policy fields, such as Workspace, SandboxRef, or Permissions, are applied. Keep
the existing resolveOrRegisterCalled assertion to verify registration is not
invoked.

In `@internal/daemon/native_automation_tool_query.go`:
- Around line 13-33: Remove the duplicated JobID, TriggerID, and WorkspaceID
fields between automationJobHistoryInput, automationTriggerHistoryInput, and
automationRunQueryInput so JSON decoding cannot shadow embedded values. Update
the affected handlers and promoted query() usage to read the retained
automationRunQueryInput fields, while preserving each input’s required
identifier behavior.

In `@internal/daemon/native_automation_tools_test.go`:
- Around line 481-516: Replace t.Fatalf calls in the ListJobsFn, GetJobFn, and
ListRunsFn stubs with t.Errorf followed by returning an appropriate sentinel
error, preserving the existing successful return values otherwise. Apply the
same goroutine-safe callback behavior to the related GetTriggerFn and GetRunFn
stubs if they use the same assertion pattern, so failures propagate to the
registry call site.

In `@internal/daemon/native_tool_workspace_memory_calls.go`:
- Around line 30-42: Update the Resolve error handling in the scoped branch of
native workspace listing to pass the resolver failure through
nativeNetworkInputError before returning it. Preserve the existing successful
resolution and List error behavior so workspace_list returns a typed ToolError
with the expected code and reason for resolution failures.

In `@internal/extension/host_api_automation_binding.go`:
- Around line 25-45: Replace the paginated single-ID lookup loop with a direct
GetJob/GetTrigger call in the bound automation lookup helpers, then compare the
returned resource’s workspace ID with the bound workspace ID. Convert lookup
errors or workspace mismatches to the existing not-found behavior, preserving
the hidden-resource semantics and avoiding repeated full workspace scans from
requireBoundAutomationRunFilter.

In `@internal/extension/host_api_test.go`:
- Line 256: Update the inner table-driven subtest launched by t.Run in the host
API tests to call t.Parallel() at the start of its callback. Preserve the
existing test cases and enclosing-suite behavior while ensuring each read-only
or expected-failure case uses the required parallel execution pattern.

In `@internal/extension/host_api_workspace_binding.go`:
- Around line 28-40: Remove the redundant hostAPIWorkspaceBinding type alias and
the lowercase constant aliases in the alias block, including
hostAPIWorkspaceScopeKindKey. Update any references to use the original exported
HostAPIWorkspaceBinding type and constants directly within the package.
- Around line 224-319: Centralize workspace-binding behavior by exporting a
resolver-parameterized binder from
internal/extension/host_api_workspace_binding.go, covering reference
canonicalization, scope-literal binding, and resource-scope validation while
preserving RPC-error wrapping in the handler layer. Update
internal/mcp/serve_binding.go to replace bindWorkspaceString, bindString,
bindResourceScope, and validateResourceScope with calls to the shared binder;
both sites must use identical blank scope.id handling and resolver behavior.

In `@internal/workspace/discovery.go`:
- Around line 12-59: Replace the duplicated nearest-enclosing workspace
selection logic in Resolver.lookupWorkspaceByEnclosingRoot with the consolidated
shared algorithm used by the CLI workspace-authoring flow. Ensure both callers
use the same root matching, depth comparison, and tie-breaking behavior,
removing the local implementation rather than maintaining a second variant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread internal/api/core/agent_identity.go Outdated
Comment thread internal/cli/marketplace.go
Comment thread internal/cli/session_event_output.go
Comment thread internal/cli/session_event_output.go
Comment thread internal/cli/workspace_resolution.go
Comment thread internal/daemon/native_workspace_input_binder.go
Comment thread internal/daemon/native_workspace_input_binder.go
Comment thread internal/mcp/serve_binding.go Outdated
Comment thread internal/workspace/resolver_crud.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
internal/daemon/native_automation_scope.go (1)

118-147: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Point lookup with ownership validation resolves the previous enumeration concern.

hasOwnedTarget reads as "already validated" while it is set before the ownership check runs; the control flow is correct (any failed check returns early), but a name like hasTarget would match the semantics. Fail-closed behavior for runs without job/trigger targets is right.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/daemon/native_automation_scope.go` around lines 118 - 147, Rename
hasOwnedTarget in the run lookup flow to hasTarget, since it indicates that a
job or trigger target exists before ownership validation completes. Preserve the
existing early returns for failed workspace ownership checks and the fail-closed
ErrRunNotFound behavior when no target is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/cli/mcp_serve_test.go`:
- Around line 101-135: Update the test’s getWorkspaceFn stub to record the
received ref instead of calling t.Fatalf inside the callback, since it may
execute on a worker goroutine. After runMCPServe returns, assert the recorded
ref equals "/workspace/project" from the test goroutine, while preserving the
existing canonical workspace assertion.

In `@internal/extension/host_api_automation_binding.go`:
- Around line 25-33: Update the bound job lookup helper around automation.GetJob
to normalize only automationpkg.ErrJobNotFound, returning the original error for
cancellations and other manager failures; apply the same treatment in the
trigger lookup helper around automation.GetTrigger for
automationpkg.ErrTriggerNotFound. Both affected sites are
internal/extension/host_api_automation_binding.go lines 25-33 and 50-58.

---

Nitpick comments:
In `@internal/daemon/native_automation_scope.go`:
- Around line 118-147: Rename hasOwnedTarget in the run lookup flow to
hasTarget, since it indicates that a job or trigger target exists before
ownership validation completes. Preserve the existing early returns for failed
workspace ownership checks and the fail-closed ErrRunNotFound behavior when no
target is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 204f2c4b-0f42-4e1d-b8c4-f7213b27b695

📥 Commits

Reviewing files that changed from the base of the PR and between 1ddfb91 and be77bef.

⛔ Files ignored due to path filters (2)
  • skills/compozy/references/native-tools.md is excluded by !**/*.md
  • skills/compozy/references/runtime-operations.md is excluded by !**/*.md
📒 Files selected for processing (44)
  • internal/agentidentity/identity.go
  • internal/api/core/agent_identity.go
  • internal/api/core/tasks_internal_test.go
  • internal/automation/manager_definition_sync.go
  • internal/bundles/service_materialize_bridge.go
  • internal/cli/agent_mutate.go
  • internal/cli/agent_mutate_requests.go
  • internal/cli/authored_context.go
  • internal/cli/authored_context_heartbeat_commands.go
  • internal/cli/client_workspace_authoring.go
  • internal/cli/loop_test.go
  • internal/cli/marketplace.go
  • internal/cli/marketplace_test.go
  • internal/cli/mcp_serve_test.go
  • internal/cli/session_event_output.go
  • internal/cli/session_test.go
  • internal/cli/skill_workspace.go
  • internal/cli/task_list.go
  • internal/cli/task_test.go
  • internal/cli/workspace.go
  • internal/cli/workspace_resolution.go
  • internal/cli/workspace_test.go
  • internal/daemon/loop_runtime_adapters_test.go
  • internal/daemon/native_automation_scope.go
  • internal/daemon/native_automation_tool_query.go
  • internal/daemon/native_automation_tools_test.go
  • internal/daemon/native_create_tools.go
  • internal/daemon/native_create_tools_test.go
  • internal/daemon/native_loop_tools_test.go
  • internal/daemon/native_tool_approval_grants_test.go
  • internal/daemon/native_tool_workspace_memory_calls.go
  • internal/daemon/native_tools_test.go
  • internal/daemon/native_workspace_input_binder.go
  • internal/daemon/notifier_test.go
  • internal/extension/host_api.go
  • internal/extension/host_api_automation_binding.go
  • internal/extension/host_api_test.go
  • internal/extension/host_api_workspace_binding.go
  • internal/mcp/serve_binding.go
  • internal/mcp/serve_test.go
  • internal/workspace/discovery.go
  • internal/workspace/resolver_crud.go
  • internal/workspace/resolver_test.go
  • web/src/systems/tasks/hooks/__tests__/use-task-orchestration-hooks.test.tsx
💤 Files with no reviewable changes (1)
  • internal/daemon/native_automation_tool_query.go
🚧 Files skipped from review as they are similar to previous changes (24)
  • internal/daemon/native_loop_tools_test.go
  • internal/daemon/native_create_tools.go
  • internal/daemon/native_tool_approval_grants_test.go
  • web/src/systems/tasks/hooks/tests/use-task-orchestration-hooks.test.tsx
  • internal/api/core/agent_identity.go
  • internal/workspace/discovery.go
  • internal/bundles/service_materialize_bridge.go
  • internal/workspace/resolver_crud.go
  • internal/daemon/native_tool_workspace_memory_calls.go
  • internal/extension/host_api_test.go
  • internal/daemon/notifier_test.go
  • internal/cli/skill_workspace.go
  • internal/daemon/loop_runtime_adapters_test.go
  • internal/cli/session_event_output.go
  • internal/automation/manager_definition_sync.go
  • internal/cli/marketplace.go
  • internal/mcp/serve_test.go
  • internal/workspace/resolver_test.go
  • internal/cli/workspace_test.go
  • internal/daemon/native_workspace_input_binder.go
  • internal/extension/host_api_workspace_binding.go
  • internal/cli/workspace_resolution.go
  • internal/cli/session_test.go
  • internal/daemon/native_tools_test.go

Comment thread internal/cli/mcp_serve_test.go
Comment thread internal/extension/host_api_automation_binding.go
@pedronauck
pedronauck merged commit c79917f into main Jul 28, 2026
1 of 3 checks passed
@pedronauck
pedronauck deleted the fix-workspace branch July 28, 2026 17:26

This branch was successfully deployed

1 active deployment
Preview — 6f42a8f4 Deployed Jul 28, 2026 by vercel[bot]
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