Skip to content

fix: dispatch workers with /address-issue <id> only (#118)#119

Open
polymath-orchestrator wants to merge 2 commits into
mainfrom
ao/agent-orchestrator-87/issue-118-dispatch
Open

fix: dispatch workers with /address-issue <id> only (#118)#119
polymath-orchestrator wants to merge 2 commits into
mainfrom
ao/agent-orchestrator-87/issue-118-dispatch

Conversation

@polymath-orchestrator

@polymath-orchestrator polymath-orchestrator commented Jul 8, 2026

Copy link
Copy Markdown

Closes part of #118 (the ao-daemon half — intake + orchestrator dispatch surfaces). The sx-skills half (durable progress written to the ticket at each phase; AC #3) lives in the separate sx asset system and is tracked/synced there, not in this repo.

What changed

Two dispatch surfaces stopped emitting long, hand-shaped worker prompts and now emit exactly /address-issue <id>:

  1. Daemon intake (trackerintake/observer.go) — BuildIssuePrompt dumped the full issue (title/url/labels/body) + an "implement the change… open a PR" footer. It now returns exactly /address-issue <id>. New intakeIssueRef reduces the canonical native id (owner/repo#N for GitHub) to the number the skill consumes, falling back to the trimmed native for a #-less id. The dead body-dump truncation machinery (intakePromptFooter, intakePromptTruncationNotice, maxIntakePromptLen, capIntakePrompt, truncateUTF8) is removed. The canonical id still rides in the session's IssueID env — only the prompt is trimmed.
  2. Orchestrator system prompt (session_manager/manager.go) — orchestratorPrompt taught coordinators to ao spawn … --prompt "<clear worker task>". It now shows --prompt "/address-issue <issue-id>" and states plainly that every worker is dispatched with exactly /address-issue <issue-id> and nothing more, because the router is self-sufficient and durable context lives in the ticket.

Why

The router /address-issue already resolves the repo, reads the issue, claims, works, reviews, and (via the skills half) writes durable progress back to the ticket. Handing workers a long custom prompt is redundant and fragile — context in a spawn prompt dies with the session; context in the ticket survives and lets a resumed/replacement worker pick up from the id alone.

Acceptance criteria coverage (ao half)

  • Daemon intake spawns a worker whose prompt is exactly /address-issue <id> — regression test TestBuildIssuePromptIsRouterInvocationOnly + TestPollSpawnsWorkerForEligibleIssue
  • Orchestrator-spawned workers get /address-issue <id> only — TestSpawnOrchestrator_UsesCoordinatorPrompt asserts the new form and that <clear worker task> is gone
  • No dispatch path emits the old issue-body-dump / "implement the change" footer — repo-wide grep in the PR sweep; dead code removed
  • Regression coverage for the intake prompt (asserts /address-issue <id> form)
  • sx skill durable-progress changes — out of repo, tracked/synced in sx
  • Upstream PR — see note below

Vanilla rule / upstream

Both files are backend/daemon code under the hard vanilla rule. Changes are upstream-shaped (prompt content only, no structural fork). An upstream PR will be opened for the intake + orchestrator prompt changes; we carry the delta here.

session_manager/** is a sensitive path — autonomous merge parks this for a human reviewer by policy.

Testing

  • go build ./..., go vet ./..., go test ./... — all green
  • golangci-lint run (v2.12.2) on changed packages — 0 issues
  • gofmt -l — clean

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

polymath-orchestrator and others added 2 commits July 8, 2026 01:45
BuildIssuePrompt previously dumped the issue title/url/labels/body plus an
"implement the change… open a PR" footer into the worker's spawn prompt. That
is exactly the long custom prompt GH #118 bans: the worker's /address-issue
router is self-sufficient (resolves the repo, reads the issue, claims, works,
reviews, writes durable progress back to the ticket), so it needs only the
issue reference.

BuildIssuePrompt now returns exactly `/address-issue <id>`. intakeIssueRef
reduces the canonical native id (owner/repo#N for GitHub) to the number the
skill consumes; it falls back to the trimmed native for providers without a
'#'. The now-dead body-dump truncation machinery (footer, notice, cap,
truncateUTF8, maxIntakePromptLen) is removed. The canonical id still rides in
the session's IssueID env — only the prompt is trimmed.

Regression tests assert the exact `/address-issue <id>` form and that no issue
context leaks into the prompt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EGzowftkQ6X38TDKjH24Y
orchestratorPrompt taught coordinators to `ao spawn … --prompt "<clear worker
task>"`, i.e. to hand-write a long task description for every worker — the root
cause GH #118 targets on the orchestrator side. The prompt now shows
`--prompt "/address-issue <issue-id>"` and states plainly that every worker is
dispatched with exactly `/address-issue <issue-id>` and nothing more, because
the router is self-sufficient and durable context lives in the ticket.

Touches a sensitive path (session_manager); full CI run per commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EGzowftkQ6X38TDKjH24Y

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the backend daemon’s two worker-dispatch surfaces to emit only a /address-issue <id> router invocation (instead of long, hand-shaped prompts), aligning intake + orchestrator behavior with GH #118’s “router-only dispatch” contract.

Changes:

  • Updated the orchestrator system prompt to instruct spawning workers with --prompt "/address-issue <issue-id>" and explicitly forbid custom task prompts.
  • Simplified tracker intake worker prompts to "/address-issue <ref>" and removed the old issue body dump + truncation/footer machinery.
  • Updated/added regression tests to pin the new router-only prompt behavior and ensure the old guidance/prompt content is gone.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
backend/internal/session_manager/manager.go Orchestrator system prompt now teaches router-only worker dispatch.
backend/internal/session_manager/manager_test.go Regression assertions for the updated orchestrator prompt + removal of old guidance.
backend/internal/observe/trackerintake/observer.go Intake prompt generation now returns only /address-issue <id>; removed prompt-capping/body-dump logic.
backend/internal/observe/trackerintake/observer_test.go Regression tests updated to assert exact router-only intake prompts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +442 to +447
// intakeIssueRef reduces a canonical tracker id to the reference the
// `/address-issue` skill consumes. GitHub's native form is "owner/repo#123" and
// the skill wants the issue number (it resolves the repo itself from the
// worker's environment), so everything after the last '#' is the reference. A
// native id without a '#' is passed through trimmed, so non-GitHub providers
// still yield a resolvable argument instead of an empty one.
Comment on lines +416 to +418
// TestBuildIssuePromptRefFallsBackToNative covers a native id that carries no
// "#N" suffix: the whole trimmed native is used verbatim so the worker still
// gets a resolvable reference rather than an empty argument.
@polymath-orchestrator

Copy link
Copy Markdown
Author

Final-review (independent, claude/fable — cross-family to the codex implementer): CLEAN. No medium+ findings.

  • observer.go: BuildIssuePrompt → exactly /address-issue <id>; truncation/footer machinery removed; intakeIssueRef correctly reduces owner/repo#123123 and passes non-GitHub refs through trimmed; test pins the exact prompt. Correct.
  • manager.go: orchestrator prompt now mandates /address-issue <id>-only dispatch. It's the session_manager path (so it parks per policy) but the change is a prompt string — substantively low-risk, safe to merge.
    Verdict: merge-ready, parked for Nick (sensitive path). Gate the deploy behind Daemon restart must not SIGKILL running agents #123.

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.

2 participants