Skip to content

fix(orchestration): bound completed-task results in task-list --brief - #24845

Closed
brynnclaw wants to merge 1 commit into
stablyai:mainfrom
brynnclaw:fix/task-list-brief-result-bound
Closed

brynnclaw wants to merge 1 commit into
stablyai:mainfrom
brynnclaw:fix/task-list-brief-result-bound

Conversation

@brynnclaw

Copy link
Copy Markdown
Contributor

ELI5

A coordinator can ask for the short version of its task list (task-list --brief). Each task's description was already shortened in that view, but each finished task's full report still came back. So the "short" list could still run to tens of kilobytes. Now the report is shortened the same way as the description, and a flag says when it was cut. The full list still returns everything.

What Changed

  • Before: orca orchestration task-list --brief --json capped each task's spec at 160 characters but returned every completed task's result in full. Those results are often whole worker reports that worker_done already delivered. The issue measured 51 KB of result text in one 39-task brief listing.
  • After: under --brief, result gets the same treatment as spec. Whitespace is collapsed and the text is capped at 160 characters with a trailing …. The cut never splits a surrogate pair. Each row carries a new result_truncated boolean. A null result stays null with result_truncated: false. Without --brief, rows are unchanged and full results come back as before.
  • Mechanism: the runtime already applies the shared abbreviateOrchestrationTasks helper (src/shared/orchestration-task-summary.ts) to brief listings. It now abbreviates result through the same abbreviateText path it uses for spec. A field that a runtime has already marked (spec_truncated or result_truncated present) passes through unchanged, so applying the helper twice is safe.
  • CLI fallback: the client-side fallback in task-list now runs when result_truncated is missing, instead of when spec_truncated is missing. A newer CLI talking to a runtime that abbreviates only specs therefore still bounds results. It keeps that runtime's spec and spec_truncated as they are.
  • The task-list help note and the coordinator-loop reference in the orchestration skill guide now say "spec and result". src/cli/bundled-skill-guides.ts is regenerated from the guide with pnpm run generate:bundled-skill-guides.

Why

The issue asks to bound or omit result under --brief, with explicit truncation metadata. Full results must stay available in the non-brief response, and older clients and runtimes must keep working.

  • Bound instead of omit: a coordinator scanning a brief list can still see the start of each outcome, such as a leading status line. result_truncated tells it when to drop --brief and read the full text.
  • Reuse the spec logic: one cap, one normalization and one surrogate-safe cut keep the brief view predictable. There is no second truncation implementation.
  • Truncate on the server: this follows the existing reason for the brief parameter. It keeps --brief cheap over SSH and relay links instead of sending text the client throws away.
  • Alternatives considered: a separate --omit-results flag would add CLI surface for something --brief already means. A larger cap for results would make the brief view inconsistent and would still grow with the size of the run.

Linked Issue

Fixes #20701

Visual Proof

N/A: no visual change. This affects the CLI's --brief JSON and text output and the runtime RPC response. Text mode never prints result, and no renderer code changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Tested on Linux x64 with Node 24. Every new test fails on current main and passes with this change (8 failed and 36 passed before; 44 of 44 passed after, in the three files below):

  • src/shared/orchestration-task-summary.test.ts: a 10 KB result is capped to 160 characters and flagged. Null and short results stay untruncated. No lone surrogate is left at the cut. Fields a runtime already abbreviated are left untouched. The two existing exact-shape assertions now also include result_truncated: false.
  • src/cli/handlers/orchestration-task-list-brief.test.ts: a runtime that abbreviates only specs gets its results capped on the client, and its spec is kept. Fully abbreviated server rows still pass through as the same object.
  • src/main/runtime/rpc/methods/orchestration/runs/tasks-dispatch.test.ts: through the real RPC method and database, a completed task's 10 KB result is bounded under brief. A task that has not started keeps result: null. The non-brief listing returns the full result with no result_truncated key.

Local checks on this branch:

  • pnpm lint: passes (all 17 steps, including the type-aware oxlint step and verify:bundled-skill-guides).
  • pnpm typecheck: the CLI and web projects pass at full size. The node project needs more than the 8 GB memory limit of the test machine. It was checked through the changed files and their full import graph (about 5,500 source files) and passes.
  • pnpm test: 135 test files pass, 1,246 tests with 0 failed. They are the three files above plus their neighbours: the CLI orchestration handlers, CLI specs and skills, the shared orchestration helpers, all orchestration RPC methods and the skill-guide scripts. The full suite was not run locally.
  • pnpm build: not run locally.

CI will run the full suites.

AI Disclosure

Claude Opus 5.5 (claude-opus-5-5), Anthropic. An AI coding agent wrote the change, the tests and this description. The account owner approved posting it.

Review

AI coding-agent review summary:

  • Cross-platform: pure string handling in shared TypeScript. No paths, shells or platform APIs are involved, so it behaves the same on macOS, Linux and Windows.

  • SSH/remote/local: truncation happens in the runtime that owns the data, so remote and relay clients receive the smaller payload. With mixed versions:

    • A new CLI with an old runtime: the client-side fallback bounds both fields.
    • A new CLI with a runtime that bounds only specs: results are bounded on the client and the spec is kept.
    • An old CLI with a new runtime: it receives bounded rows plus an extra boolean that it ignores.

    brief is an opt-in summary request, and the full listing does not change. No other caller sends brief; worker settlement uses the full listing.

  • Agent and integration compatibility: provider-neutral. An agent that needs full results runs task-list without --brief, as the help text and skill guide now say.

  • Performance: one regex and one slice per row, only when --brief is requested. Brief responses get smaller.

  • UI: not applicable; no renderer changes.

  • Security: no new inputs, outputs or privileges. The cut never splits a surrogate pair, so strict JSON consumers never receive malformed UTF-16.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Not applicable: the only skill-guide change is one paragraph of Orca's own orchestration reference, and its regenerated bundle.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

task-list --brief capped each spec but still returned every completed
task's full result, often a whole worker report already delivered via
worker_done. Apply the same whitespace-collapsing, surrogate-safe
160-character cap to result and flag shortened rows with
result_truncated. The non-brief listing is unchanged.

The CLI client-side fallback now keys on result_truncated, so a newer
CLI talking to a spec-only brief runtime still bounds results, and
fields a runtime already abbreviated are left untouched.

Fixes stablyai#20701
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 08c64625-97ed-4cfb-a8f4-b8b1a0dc39a3

📥 Commits

Reviewing files that changed from the base of the PR and between de8bffe and 98e5ec8.

📒 Files selected for processing (8)
  • skill-guides/orchestration/references/coordinator-loop.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration-task-list-brief.test.ts
  • src/cli/handlers/orchestration/task-handlers.ts
  • src/cli/specs/orchestration.ts
  • src/main/runtime/rpc/methods/orchestration/runs/tasks-dispatch.test.ts
  • src/shared/orchestration-task-summary.test.ts
  • src/shared/orchestration-task-summary.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Brief task summaries now cap both specs and string results at 160 characters. The shared helper returns truncation flags for both fields and preserves supplied flags. The CLI applies its abbreviation fallback when a task lacks result_truncated. Tests cover null and long results, Unicode-safe truncation, pre-abbreviated specs, and full-mode responses. Command descriptions now document the spec and result limits.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 98e5e

Brief task listings bound results while full listings retain them, and the shipped guidance reflects the change. No actionable merge blocker remains after normal checks.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 98e5e

The change reduces report text returned in brief listings without changing task ownership, stored results, or caller authority. Full listings remain available, and compatibility handling preserves existing truncation information. No material security risk was found in the reviewed change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective change is limited to task text returned through existing brief listings and consumed by the CLI or coordinator. It reduces echoed result content rather than expanding accessible runs, assets, credentials, or mutation authority. The supplied cloud assignment and migration paths are lexical references, with no changes in the inspected base/head comparison.

Trust Boundaries and Controls

  • observed — Caller/run inputs are unchanged. The runtime retains its existing run-selection behavior, including the explicit legacy-run branch, before listing tasks. The new result abbreviation occurs afterward and cannot alter that selection. This establishes unchanged boundary behavior for this change, not a fresh verification of the underlying authorization system.

Resilience and Maintainability Implications

  • inferred — Per-result abbreviation reduces brief-response volume but is not a total-response or resource-consumption limit: task count and other fields remain unchanged, and full strings are read before abbreviation. The reviewed change does not introduce a stronger resource or content-security guarantee.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 6 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: bounding completed-task results in task-list --brief.
Description check ✅ Passed The description follows the required template and explains the user impact, implementation, rationale, linked issue, testing, compatibility, and checklist status. It also clearly documents that the fu…
Linked Issues check ✅ Passed Issue #20701 requires bounded result values in task-list --brief, explicit truncation metadata, full results in non-brief mode, compatibility with older runtimes, and tests for long, null, Unicode…
Out of Scope Changes check ✅ Passed The changed runtime helper, CLI handler, tests, help text, and orchestration guide all support issue #20701. The tests validate the new result behavior and backward compatibility. No unrelated change …
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 6 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • Bound result under --brief — abbreviateOrchestrationTasks now abbreviates result through the same abbreviateText path as spec, adding a stable result_truncated boolean to every brief row while leaving non-brief rows untouched.
  • Idempotent pass-through — a field already marked by a runtime (spec_truncated/result_truncated present) is kept verbatim, so the client fallback no longer re-collapses an already-capped spec.
  • CLI fallback re-keyed — task-handlers.ts now triggers client-side abbreviation when result_truncated is missing instead of spec_truncated, so a newer CLI bounds results against a spec-only runtime while preserving that runtime's spec.
  • Docs + regenerated bundle — CLI spec note, coordinator-loop reference, and bundled-skill-guides.ts now say "specs and results".

Compatibility across all CLI/runtime version mixes checks out: old CLI suppresses its fallback (spec flag present) and ignores the new boolean; new CLI against a pre-brief runtime still caps both. No renderer or mobile consumer reads these fields. Each new test fails on pre-change main, so the coverage is real.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for digging into this and for the careful mixed-version handling in the fallback. Since this PR was opened, #36622 changed orca orchestration task-list so its default output (including --brief --json) carries only each task's id, status, title and related ids. Specs and results now appear only when you pass --full. That removes the large completed-task result payloads described in #20701 (a 138-task Run went from 407 KB to 11.5 KB), so we're closing this as already addressed on main. If you still see oversized task-list output on a current build, please open a new issue with the exact command and output size.

@nwparker nwparker closed this Nov 12, 2026
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.

Reduce completed-task result payloads in orchestration task-list --brief

2 participants