Skip to content

fix(client-runtime): map cancelled and interrupted subagent terminal statuses - #11608

Open
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/codex-subagent-terminal-status
Open

fix(client-runtime): map cancelled and interrupted subagent terminal statuses#11608
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/codex-subagent-terminal-status

Conversation

@Exotic209093

@Exotic209093 Exotic209093 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex subagents that complete with 'cancelled' or 'interrupted' status were falling through to 'running' because TASK_COMPLETED_STATUS only covered completed, failed, and stopped. This adds both missing entries so the fold correctly marks them as terminal.

Fixes #11164

Summary by CodeRabbit

  • Bug Fixes
    • Subagent tasks that are cancelled or interrupted now display the correct terminal status instead of being marked as completed.
    • Task summaries are preserved as results, and completion times are recorded for cancelled and interrupted tasks.

…statuses

Codex subagents that complete with 'cancelled' or 'interrupted' status
were falling through to 'running' because TASK_COMPLETED_STATUS only
covered completed, failed, and stopped. Add both missing entries so
the fold correctly marks them as terminal.

Fixes pingdotgg#11164
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T18:02:36.666042Z 62e0f58 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Sep 13, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 62e0f58

Macroscope's review found this PR approvable — This is a focused client-runtime bug fix that maps existing cancelled and interrupted completion statuses to their corresponding terminal states. It adds targeted tests and does not affect schemas, defaults, infrastructure, security, billing, or static-analysis configuration.

You can add or adjust custom eligibility rules. Learn more.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62e0f58d2d

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +433 to +434
["cancelled", "cancelled"],
["interrupted", "interrupted"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Extend the task-completion wire contract

These branches cannot handle normal production events because TaskCompletedPayload.status in packages/contracts/src/providerRuntime.ts still permits only completed, failed, and stopped; current Codex interruption paths also emit task.updated, not task.completed. The new tests bypass that contract with a cast, so they exercise fabricated activity rows while the reported live task.completed scenario remains unsupported. Add these statuses to the contract and normalize them through the relevant adapter and ingestion paths before relying on this client mapping.

AGENTS.md reference: AGENTS.md:L71-L72

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 1d64c0f3-f2ce-44d3-90ba-9e84e9987a90

📥 Commits

Reviewing files that changed from the base of the PR and between 77bca8b and 62e0f58.

📒 Files selected for processing (2)
  • packages/client-runtime/src/state/subagentRuntime.test.ts
  • packages/client-runtime/src/state/subagentRuntime.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The runtime now maps task.completed payloads with cancelled or interrupted status to matching terminal agent states. Tests verify the status, summary result, and completion timestamp.

Changes

Subagent terminal status mapping

Layer / File(s) Summary
Status mapping and validation
packages/client-runtime/src/state/subagentRuntime.ts, packages/client-runtime/src/state/subagentRuntime.test.ts
TASK_COMPLETED_STATUS now maps cancelled and interrupted to their matching terminal statuses. Tests verify the folded result and non-null completedAt value for both statuses.

Priority: ⬆️ High

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: High

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 62e0f

Cancelled and interrupted subagent completions now retain their terminal states, with tests covering their results and completion timestamps.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #11164 requires all Codex status mappings: pendingInitpending, runningrunning, interruptedinterrupted, completedcompleted, erroredfailed, shutdowncancelled, and `no… Implement the complete Codex status mapping required by #11164 in the status update path. Add automated tests for all seven Codex statuses, including terminal timestamps and the expected internal status.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: mapping cancelled and interrupted subagent terminal statuses.
Description check ✅ Passed The description clearly explains what changed and why. It identifies the affected mapping and the resulting terminal-state behavior. It does not include the template headings or checklist, but the mis…
Out of Scope Changes check ✅ Passed The changes modify subagent status translation and add focused tests for terminal subagent states. These changes directly relate to issue #11164. No unrelated product behavior is present in the review…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Linked Issues check

Explanation

Issue #11164 requires all Codex status mappings: pendingInitpending, runningrunning, interruptedinterrupted, completedcompleted, erroredfailed, shutdowncancelled, and notFoundfailed. The pull request adds only cancelledcancelled and interruptedinterrupted to TASK_COMPLETED_STATUS. It does not add the required Codex keys pendingInit, errored, shutdown, or notFound. The new tests cover only cancelled and interrupted.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex subagent terminal statuses fall through to running in orchestrator v2

1 participant