Skip to content

flows: enforce agent max_result_chars on the agent_ref (run_via_harness) path #5208

Description

@graycyrus

Pre-existing, systemic (surfaced by review of #5205).

An agent node's config.agent_ref routes to OpenHumanAgentRunner::run_via_harnessAgent::run_singlebuild_agent_result, which passes the agent's full response downstream. The selected agent definition's max_result_chars cap is only enforced in the separate subagent-runner path, NOT here. So a verbose agent_ref agent (context_scout, researcher, flow_memory_agent, …) can place far more than its declared cap into the flow's downstream context.

Scope: affects every agent_ref agent, not one — a shared limitation of the flow engine seam (src/openhuman/tinyflows/caps.rs), not any single agent PR. Deliberately not fixed inside #5205 (that PR is purely additive; this is a main-module engine change touching all agents).

Fix: truncate the harness turn's final text to the resolved definition's max_result_chars in run_via_harness/build_agent_result (char-safe), matching the subagent-runner's enforcement. Add a test.

Meanwhile #5205's flow_memory_agent mitigates via prompt guidance (return a short, distilled answer).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions