Skip to content

bug(index): worktree_strategy="delegate" silently ignored; no validation when strategy="auto" but branch unset #5

Description

@apex-skyner

Problems

1. worktree_strategy: "delegate" not supported

The dev-agent-routing skill uses:

worktree_strategy: 'delegate'  // plugin creates worktree automatically

But the WorktreeStrategyEnum only has "auto" and "off". Any delegate value causes a schema validation error from OpenClaw before the tool even runs. delegate should be an alias for auto (the plugin IS doing the worktree creation).

2. No validation: auto strategy without branch

When worktree_strategy === "auto" but branch is not provided, the code silently falls through and works in the original workdir without creating a worktree. The user intended isolation and gets none — a silent footgun.

// current — silently no-ops on worktree creation when branch is missing
if (worktreeStrategy === 'auto' && params.branch) {
  ...
}

Should return an error if auto is requested without a branch.

3. Sessions never pruned from memory

The in-memory Map<string, ManagedSession> in SessionManager accumulates indefinitely. Long-running OpenClaw gateway processes will grow without bound. Completed sessions older than ~24h should be pruned automatically.

Fix

  • Add "delegate" as an alias for "auto" in WorktreeStrategyEnum
  • Return { error: ... } when strategy === "auto" || "delegate"" but branch` is absent
  • Add a background pruning interval to SessionManager that removes sessions ended >24h ago

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions