Skip to content

swarm_complete fails: plugin bridge missing start_time parameter (template drift) #177

Open

Description

@mrm007

Bug

swarm_complete always fails with Missing required parameters: start_time when called through the OpenCode plugin bridge.

Workers complete their work successfully but can't mark tasks done — they fall back to hive_close instead, breaking swarm tracking.

Root Cause

Schema drift between the CLI tool implementation and the plugin wrapper template.

Layer start_time File
CLI tool implementation Required (line 1001, validated line 1038) packages/opencode-swarm-plugin/src/swarm-orchestrate.ts
MCP schema (swarm-tools) Required in required: [...] packages/swarm-tools/index.ts:368
Plugin bridge template Missing entirely packages/opencode-swarm-plugin/examples/plugin-wrapper-template.ts:1196

start_time was added as required to swarm-orchestrate.ts and the MCP schema in swarm-tools/index.ts was updated, but the plugin wrapper template was never synced.

Reproduction

⚙ swarm_complete [project_key=/path/to/project, agent_name=worker-1, bead_id=cell-abc123, summary=Did the work, skip_verification=true]
Error: Missing required parameters: start_time

Suggested Fix

Add start_time to the template's swarm_complete args (line ~1203 of plugin-wrapper-template.ts):

start_time: tool.schema
  .number()
  .optional()
  .describe("Task start timestamp (Unix ms) for duration calculation"),

And auto-inject a default in execTool or the tool's execute wrapper so workers that don't track start time still succeed:

execute: (args, ctx) => execTool("swarm_complete", { start_time: Date.now(), ...args }, ctx),

This is the same class of bug as #176 (Drizzle .default() quoting) — the core implementation changes but the surface layer doesn't get updated.

Affected Version

opencode-swarm-plugin@0.63.2

Environment

  • OpenCode with swarm plugin
  • macOS, Node 24.12.0

Activity

  1. mrm007 commented on Mar 1, 2026

    @mrm007
    Author

    Additional finding: start_time is not just missing from the plugin bridge — it's missing from the entire worker lifecycle:

    1. swarm_spawn_subtask doesn't generate or return a start_time
    2. SUBTASK_PROMPT_V2 (Step 9, the swarm_complete example) doesn't mention start_time
    3. No event in the spawn chain records a start timestamp for the worker to reference

    So even if the plugin bridge exposed start_time, workers would have no value to pass. The parameter was added to swarm-orchestrate.ts but never wired through the spawn → work → complete lifecycle.

    Suggested full fix: either

    • Have swarm_spawn_subtask include start_time: Date.now() in its return JSON (and update SUBTASK_PROMPT_V2 Step 9 to pass it through), or
    • Make start_time optional in swarm_complete and default to Date.now() (accepting inaccurate duration for workers that don't track it)
  2. Krule commented on Mar 22, 2026

    @Krule

    We hit this same bug independently and have a fix PR: #185 (makes start_time optional with Date.now() default across all 3 plugin wrappers + updated tests). Happy to get vouched if this would be useful to merge.

  3. danielacevedos commented on Aug 14, 2026

    @danielacevedos

    Confirmed on 0.63.2 (OpenCode 1.18.18, Windows): a swarm-worker following the spawn prompt had to retry swarm_complete 3 times discovering the undocumented required start_time (ISO string) parameter, since the generated spawn prompt/checklist doesn't mention it. Either defaulting start_time server-side (to the spawn/registration time) or documenting it in the worker prompt would remove that friction.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions