Skip to content

fix(TaskExecute): keep the delegation flow reachable - #64

Open
LCorleone wants to merge 1 commit into
tintinweb:masterfrom
LCorleone:fix/issue-40-delegation-steering
Open

LCorleone wants to merge 1 commit into
tintinweb:masterfrom
LCorleone:fix/issue-40-delegation-steering

Conversation

@LCorleone

Copy link
Copy Markdown

Fixes #40

Problem

As detailed in #40, orchestrator workflows almost never reach the TaskExecute delegation path. The mechanics (RPC handshake, spawn) work — the model gets steered away from them by three interacting prompt-level friction points:

  1. The system-reminder pushes "continue on with the tasks at hand" (do it yourself), the opposite of delegation
  2. TaskCreate's agentType is optional and easy to omit, and TaskExecute refuses tasks without it — the most common dead-end
  3. TaskExecute's guideline "Never use the Agent tool for tasks launched via TaskExecute" gets over-generalized, blocking the fallback even after a refusal

Net effect: task flow entered → task created without agentType → refusal → no escape hatch → stuck loop.

Changes

All in src/index.ts, prompt-level only — no schema or behaviour change beyond the default:

  • TaskCreate defaults agentType to "general-purpose" — a plain task is now delegable instead of dead-ending at TaskExecute. Only pre-existing tasks lack agentType now.
  • TaskExecute's guideline re-scoped to what it was meant to prevent: spawning a duplicate Agent for a task already running under TaskExecute (use TaskOutput to check on it). The Agent-tool fallback stays open for refused/not-launched tasks.
  • The no-agentType refusal (legacy tasks only) now points at the fallback: "…or run the work directly (e.g. via the Agent tool) since no subagent is running for it".
  • The system-reminder is delegation-aware: the JSON echo includes agentType, and when any shown pending task has one, the closing line steers toward TaskExecute instead of "continue on with the tasks at hand". agentType goes through sanitizeField() like every other echoed string.

README updated where agentType is documented (CONTRIBUTING: user-facing changes). CHANGELOG untouched per CONTRIBUTING.

Tests

  • new: reminder steers pending default-agentType tasks toward TaskExecute (and no longer contains the "continue on" line)
  • new: tasks without agentType (stripped via metadata null-delete) keep the generic closing line
  • reworked: "rejects tasks without agentType" → plain TaskCreate now spawns with general-purpose
  • new: legacy no-agentType task (seeded directly in a store file) still refused, with the run-it-directly hint
  • mixed valid/invalid batch updated for the default

npm run lint, typecheck, build clean; 407/407 tests pass.

The main agent rarely reached the TaskExecute delegation path: it was
steered to execute tasks itself, routinely created tasks without
agentType which TaskExecute then refused, and the no-fallback guideline
blocked the escape to the plain Agent tool once inside the task flow.

- TaskCreate now defaults agentType to "general-purpose" so a plain
  task is delegable instead of dead-ending at TaskExecute
- TaskExecute's guideline only forbids duplicate Agents for tasks
  already running under it; TaskOutput is the way to check on those
- The no-agentType refusal (legacy tasks only, now) points at the
  Agent-tool fallback since no subagent is running for the task
- The system-reminder echoes agentType and steers pending delegable
  tasks toward TaskExecute instead of "continue on with the tasks"

Fixes tintinweb#40
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.

TaskExecute delegation workflow is defeated by prompt steering + missing agentType default

1 participant