Skip to content

examples/cli: agent edit re-parses with a six-type control-flow allowlist that omits AgentTask, so no agent can ever be edited — while agent add from an arbitrary file has no allowlist at all #1069

Open

Description

@sroussey

Summary

workglow agent edit cannot save any real agent. After the editor closes, it re-parses the JSON with a six-entry allowlist of control-flow types: GraphAsTask, ConditionalTask, IteratorTask, MapTask, ReduceTask, WhileTask. AgentTask is not on it. An agent is "a graph holding a single AgentTask" (that is what workglow a2a serve <id> requires), so every edit to every agent fails with Task type "AgentTask" is not in the allowed types list.

workglow agent add applies no allowlist at all to JSON from an arbitrary --input-json-file. The restriction therefore sits on the one path where the input is the user's own saved agent, and is missing on the path that ingests outside files.

Evidence (main 5ceb299)

  • examples/cli/src/commands/agent.ts:247-264: agent edit builds allowedTypes: new Set(["GraphAsTask","ConditionalTask","IteratorTask","MapTask","ReduceTask","WhileTask"]), with the comment "Add additional allowed task type names here as needed", and passes it to createGraphFromGraphJSON.
  • packages/task-graph/src/task/TaskJSON.ts:125-131: the allowlist check runs for every task before constructor lookup, so the AgentTask node throws.
  • examples/cli/src/commands/agent.ts:151-176: agent add calls createGraphFromGraphJSON(json as TaskGraphJson) with no options.
  • workflow add and workflow edit (workflow.ts:178, :263) use no allowlist either, so the CLI applies the restriction on exactly one of its four ingest paths.
  • Reproduced: createGraphFromGraphJSON({tasks:[{id:"a",type:"AgentTask",defaults:{}}],dataflows:[]}, undefined, {allowedTypes: <the edit set>}) throws Task type "AgentTask" is not in the allowed types list.

No test covers agent edit, which is why this has not been noticed.

Failure scenario

  1. workglow agent add helper --input-json-file helper.json saves an agent (AgentTask plus its tools).
  2. workglow agent edit helper; the user changes the system prompt and saves.
  3. Invalid agent graph: Task type "AgentTask" is not in the allowed types list, then exit 1. The edit is lost, and the only way forward is agent remove followed by agent add, which is the unchecked path.

Implementation plan

  1. Decide what the allowlist protects, then apply it the same way on every ingest path (agent add, agent edit, and the workflow equivalents if wanted).
    • If the goal is "only types that are safe in agent graphs", build the set from the registry: every registered type minus a denylist of filesystem/shell types. Or reuse the entitlement model (INFERENCE_ENTITLEMENTS) instead of a hand-kept six-name list.
    • If there is no threat model for a user's own local file, drop the allowlist from edit.
  2. Whichever is chosen, AgentTask and the tools the agent names must pass.
  3. Add CLI tests: agent add then agent edit round-trips an AgentTask graph (stub the editor through editStringInExternalEditor), and agent add refuses whatever edit refuses.

Generated by Claude Code

Activity

  1. sroussey commented on Nov 30, 2026

    @sroussey
    CollaboratorAuthor

    Re-checked on main 0fa8452 (2026-11-30): still open as filed. examples/cli/src/commands/agent.ts:249-259 still passes allowedTypes with only the six control-flow types, so createGraphFromGraphJSON refuses the AgentTask that every saved agent holds. No commit in the 11-23 to 11-30 window touched examples/cli/src/commands/agent.ts.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    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