Skip to content

Deliver worker outcome text instead of a placeholder result - #644

Merged
jamiepine merged 1 commit into
mainfrom
jamiepine/worker-outcome-delivery
Aug 14, 2026
Merged

Deliver worker outcome text instead of a placeholder result#644
jamiepine merged 1 commit into
mainfrom
jamiepine/worker-outcome-delivery

Conversation

@jamiepine

@jamiepine jamiepine commented Aug 14, 2026

Copy link
Copy Markdown
Member

One-shot workers that finish via set_status(kind: "outcome") had their final text discarded. The status text was only broadcast as an ephemeral WorkerStatus event (capped at 256 chars), then the outcome-recorded termination path returned a hardcoded "Worker reported a terminal outcome." as the result. That placeholder became the durable terminal outcome and was exactly what the channel agent received on retrigger — so every outcome-signaled worker looked like it completed with nothing to say. Same story for the empty-result safety net, which substituted its own synthetic line.

The fix carries the real text through:

  • set_status now scrubs the full text before the 256-char display cap (previously cap-then-scrub, so truncation could split a secret out of exact-match range) and, for kind: "outcome", includes the full scrubbed text in the tool output as outcome.
  • SpacebotHook retains that text when it detects the outcome signal, exposed via take_outcome_text() and cleared with the rest of the per-prompt state.
  • Worker::run() uses the retained text as the result in both completion paths, falling back to the last assistant message, then the old placeholder only when the signal carried no text.

The task-level scrub in spawn_worker_task still runs on the final outcome, so the delivered text passes through both scrubbing layers.

Tests cover the full-text/capped-status split in the tool output, hook retention and take-consumes semantics, and reset clearing the retained text.

Note

Key Changes:

In set_status.rs: Moved secret scrubbing before the 256-char cap to prevent secrets from being split during truncation. Added outcome field to SetStatusOutput to carry the full uncapped text for outcome signals.

In spacebot.rs: Added outcome_text field to SpacebotHook to retain the full outcome text. Implemented take_outcome_text() method for consuming retained text and updated reset_tool_nudge_state() to clear it. Added tests verifying full-text retention and reset behavior.

In worker.rs: Updated both outcome completion paths to use take_outcome_text() with fallbacks to the last assistant message, then the original placeholder only when necessary.

Written by Tembo for commit 43e8bbbd. This will update automatically on new commits.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66c5597d-a1e2-4cb4-a426-f7a552c101fd

📥 Commits

Reviewing files that changed from the base of the PR and between 3e57b26 and 43e8bbb.

📒 Files selected for processing (3)
  • src/agent/worker.rs
  • src/hooks/spacebot.rs
  • src/tools/set_status.rs

Walkthrough

The change preserves successful set_status outcome text without the live 256-byte cap. SpacebotHook stores and consumes this text, and worker terminal paths use it before fallback messages.

Changes

Worker outcome text flow

Layer / File(s) Summary
Status outcome payload
src/tools/set_status.rs
SetStatusOutput now includes optional uncapped outcome text. Scrubbing occurs before live-status truncation. Tests cover outcome and progress results.
Hook outcome storage
src/hooks/spacebot.rs
SpacebotHook stores non-empty successful outcome text, exposes one-time retrieval, clears it on prompt reset, and tests these behaviors.
Worker terminal result selection
src/agent/worker.rs
Worker terminal results prefer recorded outcome text, then the last assistant response, and finally synthetic fallback text.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 43e8b

The change delivers the worker’s full scrubbed outcome text instead of a placeholder. No actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: delivering worker outcome text instead of a placeholder result.
Description check ✅ Passed The description directly explains the changes to outcome text handling, scrubbing, retention, fallback behavior, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jamiepine/worker-outcome-delivery

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.

@jamiepine
jamiepine merged commit c2f7416 into main Aug 14, 2026
4 checks passed
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.

1 participant