Skip to content

[Improve] Preserve source context for child tasks - #1190

Merged
daniel-lxs merged 4 commits into
developfrom
feat/source-context-reporting-3lz0jkztzzpzc
Aug 10, 2026
Merged

[Improve] Preserve source context for child tasks#1190
daniel-lxs merged 4 commits into
developfrom
feat/source-context-reporting-3lz0jkztzzpzc

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

​Opened on behalf of @daniel-lxs. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

Related issue

No linked issue. This is internal Roomote work requested from the communication-context launch flow.

Why this PR exists

  • A maintainer explicitly invited this PR in the linked issue or discussion
  • I am a maintainer / this is internal Roomote work

What changed

Child tasks launched from a run token now retain the parent task's provider-neutral communication coordinates (provider, channel, thread, and message identifiers). Standard agents see those coordinates in a read-only <task_source_context> block so they know where the work originated; the block carries coordinates only, with no extra behavioral rules.

The parent pointer for this inheritance travels in a dedicated transient communicationContextSourceRunId field rather than sourceRunId, so relaunch lineage, settle notifications, and the activation metric keep their existing semantics. Inheritance skips launches that already carry their own live communication context, and payloads are flagged communicationContextInherited only when coordinates were actually copied. Inherited coordinates stay informational: they do not register live reply tools, messaging instructions, or turn-satisfaction closeout hooks, while direct communication turns are unchanged.

The shared populateCommunicationMetadata helper extracted from the snapshot-resume path keeps the historical semantics where empty-string options fall back to the source payload.

How it was tested

  • Worker coverage for inherited provider-neutral context, enqueue coverage for inheritance, the own-live-context guard, and unchanged sourceRunId stamping, and prompt coverage for the source-context block.
  • Ran the touched Vitest suites in types, cloud-agents, api, and worker, plus pnpm lint:fast and pnpm check-types:fast.
  • pnpm knip reports a pre-existing configuration hint that also reproduces on develop locally; unrelated to this change.

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset

@roomote-roomote roomote-roomote Bot added the enhancement New feature or request label Aug 9, 2026
@roomote-community

roomote-community Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • Slack child reports cannot reach the inherited source thread because Slack reply routing ignores the copied provider-neutral coordinates.
  • Inherited source coordinates are still treated as live chat reply context, so child tasks can post to or be forced to close the parent conversation.
  • Inherited Teams, Telegram, and Discord coordinates still enable request_user_input callbacks, allowing a child task to post a question to the parent conversation.

Reviewed 9f6996c

Comment thread packages/cloud-agents/src/server/task-run-queue.ts Outdated
Comment thread packages/cloud-agents/src/server/task-run-queue.ts Outdated
@roomote-roomote

roomote-roomote Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Fixed inherited source-context reply safety in f955061. Inherited provider-neutral coordinates now remain informational: the worker does not export active reply environment or register turn-satisfaction closeout hooks for them. Added focused worker coverage; targeted tests, worker static checks, and the repository pre-push suite pass.

daniel-lxs and others added 2 commits August 10, 2026 16:53
- launchTask reverts to the old sourceRunId stamping (env-definition or
  notifyOnSettle only) and carries the parent pointer in a dedicated
  transient communicationContextSourceRunId field instead, so relaunch
  lineage, settle notifications, and the activation metric are unchanged
- inheritance skips launches that carry their own live communication
  context, stamps 'slack' when parent coordinates come from Slack task
  columns, and only flags communicationContextInherited when coordinates
  were actually copied
- drop the report-back rule line from task_source_context; coordinates
  only, and escape the provider like the other fields
- restore empty-string option fallback semantics in
  populateCommunicationMetadata
@daniel-lxs
daniel-lxs marked this pull request as ready for review August 10, 2026 20:03
@daniel-lxs
daniel-lxs merged commit c6c7db9 into develop Aug 10, 2026
19 checks passed
@daniel-lxs
daniel-lxs deleted the feat/source-context-reporting-3lz0jkztzzpzc branch August 10, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant