Skip to content

fix(orchestrator): name complete_task's nested handoff in its description - #1220

Open
Gilbert09 wants to merge 1 commit into
mainfrom
posthog/complete-task-nested-handoff-shape
Open

fix(orchestrator): name complete_task's nested handoff in its description#1220
Gilbert09 wants to merge 1 commit into
mainfrom
posthog/complete-task-nested-handoff-shape

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

complete_task is how every orchestrator task reports its outcome. Its
handoff fields live inside a nested handoff object — goals, did and
forNextAgent are required there — but neither the tool description nor the
pi prompt snippet said so. Agents therefore discovered the shape by sending a
flat call with those fields at the top level, failing schema validation, and
reading the rejection back before retrying.

That is one wasted turn on a task that had already finished its work, and
several task agents reported it in their end-of-task remarks — the field that
asks what would have prevented wasted turns. The rejection is informative
enough to recover from, so nothing breaks; the shape just wasn't stated where
the agent fills the call in.

Why: the same reasoning that put the model allow-list into
ENQUEUE_MODEL_DESCRIPTION — naming the shape where the value is picked costs
nothing and makes the guess unnecessary.

Changes

  • New shared COMPLETE_TASK_DESCRIPTION in queue-tools.ts, next to
    HANDOFF_FIELDS, REMARK_ASK and NOT_NEEDED_REASON_ASK. The first two
    sentences are the existing text verbatim; a third names the nesting and the
    three required fields.
  • Both harnesses now read it — the zod schema in queue-tools.ts and the
    typebox mirror in harness/pi/orchestrator-tools.ts — where the identical
    string was previously duplicated in both files. The orchestrator runs on pi,
    so a description that drifts between them is the failure mode this repo
    already guards for the handoff fields themselves.
  • The pi prompt snippet mentions the nesting too.

No behaviour change: the schemas, the guards, applyComplete, the skip
reasons and the analytics are all untouched.

Test plan

  • handoff-schema-parity.test.ts gains a block asserting the pi tool's
    description is the shared constant (mirroring the existing wizard_ask
    parity test) and that the text names the nesting and each required field.
  • pnpm build && pnpm test && pnpm fix — 162 files, 2642 tests pass, lint
    clean.

Created with PostHog Desktop

…tion

The handoff fields go inside a nested `handoff` object, but the tool
description never said so, so task agents discovered it by sending a flat
call, failing schema validation, and reading the rejection back — a turn
spent on a shape the schema could have named up front. Several task agents
reported exactly this in their end-of-task remarks.

Extract the description into one shared `COMPLETE_TASK_DESCRIPTION`, used by
both the zod (MCP) and typebox (pi) schemas so it cannot drift, and add a
closing sentence naming the nesting and the three required fields. The pi
prompt snippet says the same. No behaviour change.

Generated-By: PostHog Desktop
Task-Id: a93b5063-9174-4504-bf98-2839a5a1610a
Copilot AI lite review requested due to automatic review settings September 8, 2026 12:01
@Gilbert09
Gilbert09 requested a review from a team as a code owner September 8, 2026 12:01
@Gilbert09 Gilbert09 self-assigned this Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@Gilbert09 Gilbert09 added the stamphog Auto-merge stamp for automated PRs label Sep 8, 2026 — with PostHog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Auto-merge stamp for automated PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants