Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: delegate bounded native tools to orchestrated workers - #591

Merged
pedronauck merged 2 commits into
compozy:mainfrom
richardfogaca:fix/orchestrated-worker-permissions
Sep 10, 2026
Merged

fix: delegate bounded native tools to orchestrated workers#591
pedronauck merged 2 commits into
compozy:mainfrom
richardfogaca:fix/orchestrated-worker-permissions

Conversation

@richardfogaca

@richardfogaca richardfogaca commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What & why

Fixes #588.

Tool-capable root system Sessions now materialize a concrete delegation budget from their resolved Agent policy, matching root user Sessions. For Agents without an allowlist, both root types now materialize the native universe minus Agent denies, matching the existing effective tool policy. Loop conductors previously had an empty budget even when native tools were available, so an explicit child grant was rejected.

The stock task conductor now explicitly delegates the native discovery and skill-reading tools its workers need. Previously its spawn recipe omitted permissions, so the worker correctly received zero tools and could not load required guidance.

The recipe requires a concrete subset of the parent's budget and blocks when a required grant is unavailable. Omitted permissions still deny all delegated tools; there is no implicit child inheritance. Verdict-only and MCP-disabled runtimes remain without a default delegation budget. Sessions with a parent retain their existing budget; Agent denies and explicit overrides still bound root authority.

Implementation assistance: Richard's agent. The diff was reviewed and its results verified locally.

How you verified it

  • TestCreateAllowedToolsOverrideNarrowsAgentProfile and TestCreateSystemSessionRecordsInternalProvenance passed with -race, covering default/explicit budgets, denies, narrower overrides and unseeded provenance-linked system children. Default-budget cases failed before the fix.
  • The implementation journey, loop feedback/convergence, and goal control/restart integration suites passed together with -race (368.476s). The strengthened fixture invokes native skill lookup; it also checks a nondelegated tool remains uncallable and workers settle under the selected Agent/Profile/runtime.
  • Verdict-only and provider-disabled session tests passed with a populated native universe; explicit tool requirements still fail closed when hosted MCP is unavailable.
  • All 13 sandbox and session-hardening browser cases passed. Privacy matchers now distinguish public native tool identifiers from credential markers. An existing onboarding test awaits its asynchronous help portal before asserting its text.
  • Live orchestrated execution completed the authored task with unchanged tests passing 3/3. The child received six explicit grants; native skill lookup was callable and an undelegated task tool returned session_denied.
  • The live Loop settled done, its worker stopped, and the disposable lab teardown reported clean: true. make gate passed on the final diff: lint reported zero issues, all affected race-test packages passed, and frontend validation passed with 7,117 tests across 771 files under Node 22.

Impact

  • Native tools/CLI/API: existing session_spawn.tools and repeated spawn --tool fields are unchanged. Root delegation budgets and the shipped conductor's use of those fields change.
  • Extensibility/hooks/config: bundled conductor guidance changes; subset validation, Agent policy, TTL, parent-stop and cleanup remain authoritative. No new config or SDK contract.
  • Workspace data isolation: the child remains bound to its parent Workspace and Profile; extra tools require an explicit parent-authorized subset.
  • Official skill and Web/Docs: orchestration reference and QA scenario updated. No web UI or generated CLI-doc change.
  • Risk/rollback: workers need additional task-specific grants for operations beyond bootstrap; missing authority stays an explicit blocker. Reverting restores the missing system budget and failing zero-tool recipe.

  • make gate passes locally; this PR is delivered only after its required CI checks are green
  • New or changed behavior is covered by tests, or I explained above why not
  • If an agent wrote or co-wrote this, I named it above and verified the result myself

Summary by CodeRabbit

  • Bug Fixes
    • Root-level tool delegation budgets now apply consistently to both user and system sessions.
    • Sessions without an explicit tool allowlist now receive available native tools by default, while deny rules remain enforced.
    • Explicitly narrower tool selections continue to restrict access as configured.
    • Session tools are no longer delegated when session MCP is disabled or runtime uses verdict-only mode.
    • Spawned worker tool capabilities are now reported correctly, distinguishing callable and non-callable tools.

Copilot AI lite review requested due to automatic review settings September 10, 2026 15:54
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

@richardfogaca is attempting to deploy a commit to the Compozy Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 22dff467-c938-4ad6-8207-6da1cca236db

📥 Commits

Reviewing files that changed from the base of the PR and between a5afad2 and ad005e6.

⛔ Files ignored due to path filters (5)
  • docs/qa/scenarios/LP-implement-tasks-orchestrated-mode.md is excluded by !**/*.md
  • web/e2e/__tests__/network.spec.ts is excluded by !web/e2e/**
  • web/e2e/__tests__/sandbox.spec.ts is excluded by !web/e2e/**
  • web/e2e/__tests__/session-hardening.spec.ts is excluded by !web/e2e/**
  • web/e2e/__tests__/tasks-hardening.spec.ts is excluded by !web/e2e/**
📒 Files selected for processing (3)
  • internal/session/manager_allowed_tools.go
  • internal/session/manager_test.go
  • web/src/systems/onboarding/components/__tests__/onboarding-setup-frame.test.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The change updates root delegation tool materialization for session MCP and runtime conditions. It derives unrestricted-agent tools from the native tool universe while preserving deny and override filtering. Tests validate session policies, spawned worker tool callability, and asynchronous tooltip rendering.

Changes

Delegation tool materialization and validation

Layer / File(s) Summary
Root delegation tool resolution and coverage
internal/session/manager_allowed_tools.go, internal/session/manager_lineage_test.go
Root sessions skip delegation tools when session MCP is disabled or runtime mode is verdict-only. Unrestricted agents use the native tool universe. Deny lists and narrower overrides remain effective.
Session policy assertions
internal/session/manager_test.go
Tests configure skill_view in the tool universe and verify empty delegation tools for verdict-only runtimes and providers that disable session MCP.
Spawned worker tool assertions
internal/daemon/daemon_implement_tasks_e2e_integration_test.go
The integration test queries each spawned worker for skill_view and task_list, then verifies their callable decisions.
Onboarding tooltip synchronization
web/src/systems/onboarding/components/__tests__/onboarding-setup-frame.test.tsx
The onboarding test waits asynchronously for the workspace tooltip text.

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

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ad005

Root sessions now provide bounded native tools to eligible workers while preserving explicit denies, overrides, and restricted runtime behavior. The supplied coverage shows the intended worker access and denial boundaries, so the change is mergeable.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The session, daemon, and integration-test changes relate to the linked issue. The onboarding tooltip test change is unrelated to native tool delegation and worker spawning. Remove the unrelated onboarding test change from this pull request, or link it to a separate issue and submit it separately.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The changes provide evidence for root delegation policy handling, native tool projection, denial behavior, parent-boundary preservation, and bounded worker verification. The reviewable summary does no… Provide the stock conductor guidance or spawn recipe change in the reviewable diff, or identify the changed file and evidence that it explicitly grants the required native discovery and skill-reading tools.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: delegating bounded native tools to orchestrated workers.
Full details: Linked Issues check

Explanation

The changes provide evidence for root delegation policy handling, native tool projection, denial behavior, parent-boundary preservation, and bounded worker verification. The reviewable summary does not identify a change to the stock conductor guidance or spawn recipe that explicitly grants the required native tools, so that requirement cannot be confirmed.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR gives eligible root user and system sessions concrete, Agent-bounded native-tool delegation budgets and updates the stock task conductor to grant workers an explicit bootstrap subset.

  • Materializes the native universe when an Agent has no allowlist, while preserving Agent denies and explicit narrowing.
  • Keeps child sessions, verdict-only runtimes, and providers without session MCP unseeded.
  • Documents explicit worker grants and verifies callable and nondelegated tools in orchestration tests.
  • Adjusts browser secret-marker checks to exclude public MCP-auth ToolIDs and makes asynchronous onboarding assertions await rendered content.

Confidence Score: 5/5

The PR appears safe to merge with no outstanding actionable failure identified in the changes since the previous review.

Eligible root sessions receive a concrete Agent-bounded delegation budget, child grants remain subject to fail-closed subset validation, and unsupported runtime/provider combinations remain intentionally unseeded and covered by tests.

Important Files Changed

Filename Overview
internal/session/manager_allowed_tools.go Materializes concrete root delegation budgets from resolved Agent policy while excluding runtimes without native session-tool support.
extensions/spec-cycle/skills/cy-orchestrate-tasks/SKILL.md Updates the conductor recipe to grant a bounded native discovery and skill-reading bootstrap set explicitly.
internal/session/manager_lineage_test.go Covers root user/system budgets, unrestricted Agents, deny policies, and explicit narrowing.
internal/daemon/daemon_implement_tasks_e2e_integration_test.go Verifies that spawned workers can call delegated skill lookup while an undelegated task tool remains unavailable.
web/e2e/tests/network.spec.ts Exempts public compozy__mcp_auth* ToolIDs from a credential-marker assertion without exempting canonical credential fields.
web/src/systems/onboarding/components/tests/onboarding-setup-frame.test.tsx Awaits asynchronously rendered explanatory content after opening the onboarding workspace details.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Resolve root Agent policy] --> B{Eligible root user or system session?}
  B -- No --> C[Keep existing lineage budget]
  B -- Yes --> D[Expand explicit tools and toolsets or native universe]
  D --> E[Remove Agent-denied tools]
  E --> F[Persist concrete parent delegation budget]
  F --> G[Conductor requests explicit worker tool subset]
  G --> H{Subset of parent budget?}
  H -- Yes --> I[Spawn bounded worker]
  H -- No --> J[Reject permission widening]
Loading

Reviews (2): Last reviewed commit: "fix: preserve sessions without native to..." | Re-trigger Greptile

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 10, 2026
@pedronauck
pedronauck merged commit 7a8922f into compozy:main Sep 10, 2026
46 of 47 checks passed
@pedronauck pedronauck mentioned this pull request Sep 10, 2026
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.

Stock orchestrated workers receive no native tools from the spawn recipe

3 participants