Skip to content

Fix subagent params alias dispatch#359

Open
RED-ROSE515 wants to merge 1 commit into
CraftOS-dev:mainfrom
RED-ROSE515:fix/subagent-params-alias
Open

Fix subagent params alias dispatch#359
RED-ROSE515 wants to merge 1 commit into
CraftOS-dev:mainfrom
RED-ROSE515:fix/subagent-params-alias

Conversation

@RED-ROSE515

Copy link
Copy Markdown

Summary

Fixes #355.

Sub-agent action dispatch now accepts params as an alias for parameters.
Some LLM outputs mirror the compact action schema key params, which previously caused the runner to drop the payload before calling sub_task_end.
As a result, sub_task_end received only _session_id and failed with Invalid status.

Changes

  • Added parameter extraction helper in SubAgentRunner
  • Preserves existing parameters behavior and gives it precedence over params
  • Added regression tests for:
    • params alias dispatch
    • parameters precedence when both keys are present

Verification

  • Direct full reproduction passed
  • Focused regression functions passed
  • python -m compileall app\subagent\runner.py tests\test_subagent_runner.py passed

@RED-ROSE515

Copy link
Copy Markdown
Author

Hello @zfoong , @ahmad-ajmal , @korivi-CraftOS .
Please check this PR and let me know if it's not working on your side.
Thanks.

@zfoong

zfoong commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Is it possible to fix the output format and make sure the LLM does not return a fault format, rather than having an ad hoc parser to handle special cases like this? Code will be harder to manage with bandaid solution like this. But I would like to keep this PR open and observe if this happens too frequently. If yes, perhaps it is good to keep this here.

@RED-ROSE515

Copy link
Copy Markdown
Author

Hi @zfoong .
Yes, that is possible, and I agree this should not grow into a pile of special-case parsers.
I think the underlying prompt issue here is that the required sub-agent output format uses parameters, while the compact action list describes action schemas under params. The model appears to have copied the schema label into the action decision.
A cleaner follow-up would be to make the prompt terminology consistent, for example by rendering sub-agent action schemas under parameters, or by explicitly stating that params in the action list is descriptive only and the emitted decision must use parameters.
I kept this PR intentionally narrow because it fixes the runtime failure without changing the shared action formatter behavior. I agree we can keep it open and observe. If this happens repeatedly, then keeping this defensive alias may be worthwhile; otherwise a prompt-format cleanup may be the better long-term fix.

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.

[V1.4.1] Research subagents fail to complete sub_task_end due to error status

3 participants