Skip to content

[NO-JIRA] Subagent policy on the state machine: roles dir, default delegate recipe, strict start (R16) - #26

Merged
johnnymo87 merged 1 commit into
patched/v1.60.2from
r16-subagent-policy
Nov 22, 2026
Merged

johnnymo87 merged 1 commit into
patched/v1.60.2from
r16-subagent-policy

Conversation

@johnnymo87

Copy link
Copy Markdown
Owner

Description

This ports patch 16 (fork #9) onto v1.60.2. It is bead workstation-6w7i.26.4.6 (R16). Workstation goose-config.nix sets both env vars; goose-roles.nix supplies the roles.

  • Roles dir first: GOOSE_SUBAGENT_ROLES_DIR (~ expanded) is scanned before any other source, so a repo's .claude/agents/x.md or .goose/recipes/x.yaml cannot shadow a role. A role file that fails to parse still claims its name, so a broken role fails closed instead of letting a local impostor through.
  • Default delegate recipe: when a delegate's recipe declares no extensions (ad-hoc, agent .md, undeclared recipes), GOOSE_SUBAGENT_DEFAULT_RECIPE supplies them, and its instructions are added in front. The delegate does not inherit the parent's tools. A missing, invalid or extension-less default is an error. The delegate tool text says unscoped delegates are read-only.
  • Strict start: on v1.60.2 delegates start their extensions lazily. With the policy on, run_to_end therefore starts the saved selection before the turn and fails the delegate if any extension did not start. A reviewer whose ro-shell failed no longer runs without it.
  • Fork code lives in platform_extensions/subagent_policy.rs. summon.rs and subagent_handler.rs get 3 hook lines.
  • Not carried: "declared extensions replace the parent's", which upstream now does (fix: load recipe extensions for slash commands and delegation aaif-goose/goose#12938).

Behaviour to know at cutover:

  • A declared platform extension this goose does not have, such as skills (removed in 1.60), is dropped silently when the delegate is created, as upstream does. Workstation roles that still list skills keep working, without it.
  • Two gaps are the same as in the original patch:
    • If the delegate's provider runs its own tool loop, upstream removes stdio/HTTP extensions from its selection, so neither the read-only default nor the strict check applies to it. Workstation roles pin gcp_vertex_ai/anthropic.
    • If config.yaml cannot be read, the policy is off.

Tests: 18 exact tests, added to patched-test.yml. Two of them are end-to-end through ForegroundSubagentRunner, and the strict-start one fails without the hook. Clippy (-p goose --all-targets -D warnings) is clean.

References

johnnymo87 added a commit that referenced this pull request Nov 22, 2026
…rict extension start) on the state machine

Port of patch 16 (fork #9) onto v1.60.2, in the fork-only module
platform_extensions/subagent_policy.rs:
- GOOSE_SUBAGENT_ROLES_DIR is scanned before every other source; a role
  file that fails to parse still claims its name (fails closed).
- GOOSE_SUBAGENT_DEFAULT_RECIPE gives a delegate whose recipe declares no
  extensions that recipe's extensions and instructions; a set-but-broken
  value is an error. The delegate tool text says unscoped delegates are
  read-only.
- With the default recipe set, run_to_end starts the delegate's saved
  selection before its turn and fails the delegate if any extension did
  not start.

A declared platform extension this goose lacks (skills, removed in 1.60)
is dropped at creation, as upstream does. "Declared extensions replace the
parent's" is upstream (aaif-goose#12938) and not carried.

X-Shepherd-Wake: #26
…rict extension start) on the state machine

Port of patch 16 (fork #9) onto v1.60.2, in the fork-only module
platform_extensions/subagent_policy.rs:
- GOOSE_SUBAGENT_ROLES_DIR is scanned before every other source; a role
  file that fails to parse still claims its name (fails closed).
- GOOSE_SUBAGENT_DEFAULT_RECIPE gives a delegate whose recipe declares no
  extensions that recipe's extensions and instructions; a set-but-broken
  value is an error. The delegate tool text says unscoped delegates are
  read-only.
- With the default recipe set, run_to_end starts the delegate's saved
  selection before its turn and fails the delegate if any extension did
  not start.

A declared platform extension this goose lacks (skills, removed in 1.60)
is dropped at creation, as upstream does. "Declared extensions replace the
parent's" is upstream (aaif-goose#12938) and not carried.

X-Shepherd-Wake: #26
@johnnymo87
johnnymo87 merged commit 09c12e5 into patched/v1.60.2 Nov 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant