fix: handle wakeOnDescendantSettle in resumeSubagentRun#38441
Conversation
- When wakeOnDescendantSettle is true, continue to announce flow even if cleanupCompletedAt is already set - This fixes the case where descendant runs complete after the parent run was deferred, which previously caused the parent's completion announce to be silently dropped - Fixes issue where subagent completion notifications were not sent when spawning nested subagents
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9709123288
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR fixes a race condition in However, the fix is ineffective as written due to a second, independent guard on
There is also a minor style inconsistency: Confidence Score: 1/5
Last reviewed commit: 9709123 |
- Also reset entry.cleanupCompletedAt = undefined (not just wakeOnDescendantSettle) - This allows beginSubagentCleanup to proceed and send the announce - Use undefined for consistency with other clearing sites (lines 833, 887, 1085, 1156) Addresses Codex and Greptile review feedback on PR #38441
|
@chatgpt-codex-connector @greptile-apps Thanks for the detailed review! I've addressed the issue by also resetting Changes:
The fix should now properly allow the announce flow to execute when a subagent with descendants completes. |
|
To use Codex here, create a Codex account and connect to github. |
|
Perfect! The fix looks good. By resetting both
The announce flow will now execute properly when descendants complete during the defer period. Great work! |
✅ Local Tests PassedAll local tests are passing:
The fix is ready for review and merge. |
Summary
Fixes the issue where subagent completion notifications were not sent when the subagent spawned descendant (grandchild) agents and waited for them to complete.
Problem
When a subagent spawns descendant agents and waits for them:
defer-descendantsstate, waiting 1 second to retrycleanupCompletedAtis setresumeSubagentRunis called, but it checkscleanupCompletedAtis already set and returns earlySolution
Modified
resumeSubagentRuninsrc/agents/subagent-registry.tsto continue to the announcement flow whenwakeOnDescendantSettle = true, even ifcleanupCompletedAtis already set.Testing
Related
AI Assistance