Skip to content

feat: single worker stream context#3968

Open
fengju0213 wants to merge 6 commits intofeat/chatagent-callbacks-context-clonefrom
feat/single-worker-stream-context
Open

feat: single worker stream context#3968
fengju0213 wants to merge 6 commits intofeat/chatagent-callbacks-context-clonefrom
feat/single-worker-stream-context

Conversation

@fengju0213
Copy link
Copy Markdown
Collaborator

@fengju0213 fengju0213 commented Mar 24, 2026

Summary

Normalize streaming response handling, add task-scoped execution context, and structure worker attempt records in SingleAgentWorker.

Changes

single_agent_worker.py:

  • _consume_worker_response — unified streaming consumer replacing two inline implementations. Auto-detects delta/cumulative mode, forwards stream_callback, extracts TaskResult.
  • _build_execution_context / _attach_execution_context — builds task-scoped context (task_id, parent_task_id, worker_node_id, attempt, agent IDs) and injects into worker agent and task.additional_info.
  • _record_worker_attempt — structured attempt recording with full token_usage, execution_context, content/tool summaries. Backward-compatible fields retained with TODO.
  • AgentPool.return_agent — clears _execution_context on return to prevent cross-task leakage.
  • Removed dependency on consume_response_content_async.

Closes #

Description

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Checklist

  • I have read and agree to the AI-Generated Code Policy (required)
  • I have linked this PR to an issue (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and run uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

biefan and others added 4 commits March 24, 2026 15:00
…ments

- Remove `worker_agent.execution_context` assignment (attribute doesn't
  exist on ChatAgent, only `_execution_context` does)
- Remove unused `total_tokens` local variable
- Add backward-compat comments for duplicate fields
- Fix line-length lint errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d1aa911f-5ed7-4dd7-995e-f5240a43de30

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/single-worker-stream-context

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 and usage tips.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Mar 24, 2026
@fengju0213 fengju0213 added this to the Sprint 51 milestone Mar 30, 2026
@fengju0213 fengju0213 changed the title Feat/single worker stream context feat: single worker stream context Apr 1, 2026
@fengju0213 fengju0213 mentioned this pull request Apr 1, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review Required PR need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] SingleAgentWorker lacks unified streaming handling, task-scoped execution context, and structured attempt tracking

2 participants