fix(agents,gateway): keep subagent announces in the original thread#63143
Conversation
Greptile SummaryThis PR fixes two related bugs in the subagent announce delivery path: (1) newly spawned subagent sessions could be persisted with an incomplete Confidence Score: 5/5This PR is safe to merge — the fix is well-scoped, uses primary-wins merge semantics to avoid overwriting existing delivery context, and includes regression tests for all three changed paths. All findings are P2 or lower. The gateway seeding logic correctly guards existing delivery context via mergeDeliveryContext with primary-wins semantics. The resolveAnnounceTarget threadId extraction is numerically safe and mirrors the pattern used elsewhere. The send call now forwards threadId that was previously silently dropped. Test coverage is solid across the new paths. No files require special attention.
|
68d5bb9 to
6e49bf3
Compare
ee0be74 to
0c593cc
Compare
0c593cc to
9aa5303
Compare
|
Merged via squash.
Thanks @mariosousa-finn! |
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#63143) Merged via squash. Prepared head SHA: 9aa5303 Co-authored-by: mariosousa-finn <244526439+mariosousa-finn@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
Summary
Describe the problem and fix in 2–5 bullets:
to/threadId, and later A2A announce delivery also droppedthreadIdwhen resolving the target fromsessions.list.threadId, and include thatthreadIdin the gatewaysendcall.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.deliveryContext, so announce delivery later depended on mutable legacylast*fields; separately,resolveAnnounceTarget()extracted thread information but returned only{ channel, to, accountId }, and the A2A announcesendcall also omittedthreadId.sessions.listlookup path.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/gateway/server.agent.subagent-delivery-context.test.tssrc/agents/tools/sessions.test.tssrc/agents/tools/sessions-send-tool.a2a.test.tsUser-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.Diagram (if applicable)
For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write
N/A.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
sessions.list.Expected
channel,to,accountId, andthreadId.threadId.sendcall includesthreadId.Actual
threadId, causing delivery to miss the original thread/topic.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
to/threadIddoes not inject empty values; announce target can hydratethreadIdfromdeliveryContext/lastThreadId/origin.threadId.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.