Skip to content

Delegation tests build their inputs by hand instead of through the production delegation refresh #6316

Open

Description

@M3gA-Mind

Context

Two review findings landed on #6304 (ddeb0d65c) about eight minutes after it merged, so they never surfaced on the open PR. Both are about how the delegation tests build their inputs, not about the shipped behaviour, which is why they are filed rather than hot-fixed.

1. The unit test hand-builds the delegate instead of using the production path

crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs constructs its ArchetypeDelegationTool directly:

delegate("setup_skills", "skill_setup")

That proves the rule (closed_by_direct_handoff closes a pack whose owner is reachable through an unpacked hand-off), but it would keep passing if refresh_delegation_tools stopped synthesising setup_skills altogether — the exact coupling that made the original #6302 bug invisible.

Partial mitigation already in place: orchestrator_hands_skill_requests_to_the_skill_specialists_directly in tests/agent_harness_e2e.rs boots a real stack and asserts the belt advertises the hand-off, so the production synthesis path is covered somewhere. The gap is that the unit test's own premise is unpinned.

Ask: build the tool set through the production delegation-refresh path, or assert the hand-off name against the registry rather than a literal.

2. The e2e assertion checks a name, not the synthesized hand-off

tests/agent_harness_e2e.rs asserts that a tool with the expected name is advertised. A same-named tool that is not the synthesised delegate would satisfy it.

Weaker than it first reads: the same test also asserts that a later model request advertises specialist-only tools, which is what actually proves the hand-off reached the specialist — an impostor would not produce that. Still worth tightening the first assertion to check the advertised tool is the delegate (e.g. its description is the target's when_to_use).

Provenance

Raised by the tinysweeper/critique and tinysweeper/security lanes on ddeb0d65c. Both ran degraded (code retrieval unavailable: openrouter embeddings 403, "$10.00 daily budget exceeded"; 3 memory calls failed on cortex 502), so they reviewed the diff alone. These two findings hold up on their merits; a third from the same run, claiming ToolPolicySession::deny does not exist and main will not compile, is false — types.rs:175 defines it on a3a965a63 and ops.rs calls it correctly.

Activity

  1. self-assigned this
    on Sep 15, 2026
  2. added
    priority: p3
    on Sep 15, 2026
  3. tinysweeper commented on Sep 15, 2026

    @tinysweeper

    Test-hardening request: two review findings left on #6304 after merge argue the delegation tests build their inputs by hand rather than through the production delegation-refresh path. (1) The unit test in toolpacks_tests_scoping_and_visibility_tests.rs constructs ArchetypeDelegationTool directly, so it would still pass if refresh_delegation_tools stopped synthesising the hand-off — the coupling that hid the original #6302 bug. (2) The e2e assertion in tests/agent_harness_e2e.rs only checks that a same-named tool is advertised, not that it is the synthesised delegate; a later assertion about specialist-only tools partly covers the real behaviour. No shipped behaviour is broken and the production synthesis path is already exercised elsewhere, so this is a low-priority cleanup: build tool sets via the production refresh path, assert the hand-off name against the registry, and tighten the e2e assertion to verify the delegate (e.g. description equals the target's when_to_use).

    Labelled priority: p3.

  4. added theissue type on Sep 15, 2026
  5. added
    triage: valid
    on Oct 9, 2026
  6. senamakel commented on Oct 9, 2026

    @senamakel
    Member

    Triage: valid — Current review confirms this is a concrete, in-scope engineering issue or request: “Delegation tests build their inputs by hand instead of through the production delegation refresh”. No complete resolution is evident in current main.

  7. added
    source: team
    on Oct 9, 2026
  8. M3gA-Mind commented on Nov 16, 2026

    @M3gA-Mind
    CollaboratorAuthor

    Thanks. Main has moved on since: #8319 replaced the per-archetype delegates with one spawn_subagent tool, so refresh_delegation_tools no longer exists. The two test gaps still apply in the new form, though:

    1. The toolpacks scoping test still builds SpawnSubagentTool::scoped(...) from literal agent ids, rather than getting the tool through the production path that scopes it for a session.
    2. The e2e helper still asserts only that a tool with that name is advertised, not that it is the scoped spawn_subagent with the expected allowed agents.
      Both are small test-only changes, so this is a good first issue if anyone wants to pick it up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p3source: teamtriage: valid

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions