Skip to content

🛑 fix: Preserve BYOM Foreground Cancellation Identity - #15777

Merged
danny-avila merged 3 commits into
devfrom
danny-avila/fix-byom-foreground-run-identity
Sep 9, 2026
Merged

🛑 fix: Preserve BYOM Foreground Cancellation Identity#15777
danny-avila merged 3 commits into
devfrom
danny-avila/fix-byom-foreground-run-identity

Conversation

@danny-avila

@danny-avila danny-avila commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

I fixed foreground Stop propagation for attached BYOM commands by binding cancellation ownership to the response-scoped runtime message identity rather than the user message ID carried by the incoming HTTP request.

  • Pass the exact runtime request message ID through both fresh execution and approval resume initialization so it matches the SDK event's response run_id.
  • Preserve detached child-run isolation by applying the host abort signal only to untagged events or events matching the foreground response identity.
  • Fail closed for tagged child events when a canonical foreground identity is unavailable.
  • Cover distinct user/response IDs, approval reconstruction, detached execution ownership, and package-level type safety.
  • Pair with Code Interpreter PR #172 so Code API drains the cancellation settlement and the native worker can safely reuse the workspace.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • cd packages/api && npx jest src/agents/handlers.spec.ts --runInBand -t "run cancellation"
  • cd packages/api && npx tsc --noEmit -p tsconfig.json
  • cd api && npx jest server/services/Endpoints/agents/initialize.spec.js --runInBand --no-cache -t "binds foreground tool execution"
  • cd api && npx jest server/controllers/agents/__tests__/request.resumeMetadata.spec.js --runInBand
  • cd api && npx jest server/controllers/agents/__tests__/resume.spec.js --runInBand -t "seeds the thread parent before reconstruction"
  • npm run static-checks
  • Isolated live LibreChat handler → HTTP → Code API bridge store → native SRT worker verification with Fix: fix javascript heap out of memory error from vite #172: Stop returned in 2 ms, terminated the process tree, prevented the delayed write, cleared quarantine, and allowed immediate workspace reuse.

Test Configuration:

  • macOS arm64
  • Node.js v24.16.0
  • Ephemeral HTTP port and Redis Unix socket
  • Temporary writable native SRT workspace

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head 1fbad2a. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09T13:17:43.450821Z ed89ff5 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 1fbad2ab60

ℹ️ 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".

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head 3dfb1ee. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 3dfb1ee3ba

ℹ️ 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".

…oreground-run-identity

# Conflicts:
#	api/server/services/Endpoints/agents/initialize.js
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head ed89ff5. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: ed89ff58e4

ℹ️ 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".

@danny-avila
danny-avila merged commit 66faf4c into dev Sep 9, 2026
31 checks passed
@danny-avila
danny-avila deleted the danny-avila/fix-byom-foreground-run-identity branch September 9, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant