Skip to content

📡 fix: Expose Safe Subagent Startup Diagnostics - #592

Merged
danny-avila merged 5 commits into
mainfrom
lia/subagent-resolution-diagnostics
Oct 4, 2026
Merged

danny-avila merged 5 commits into
mainfrom
lia/subagent-resolution-diagnostics

Conversation

@lia-by-librechat

@lia-by-librechat lia-by-librechat Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Subagent identity and lazy-config failures only reached console.warn; detached execution then discarded their classification. Hosts could neither retain the startup cause nor safely explain it to the parent.

  • Add onSubagentResolutionFailure to Run/graph inputs and onResolutionFailure to direct executors. Forward it to detached and nested children.
  • Send safe phase/type/message diagnostics and parent/child correlation IDs. Give hosts the original rejection privately for class/code mapping.
  • Accept only workspace, agent-access, model/provider, configuration-change, or unknown cause codes. Generate parent messages from fixed SDK text.
  • Preserve phase/cause in detached SubagentResolutionError. Keep safe console fallback when the hook is absent or throws.
  • Bump @librechat/agents from 4.0.1 to 4.0.2.

Verification

Passed on the latest head: 608 tests across 26 focused subagent, replay-consumer, and tracing suites, npx tsc --noEmit, touched-file ESLint/import order, npm run build, npm run check:circular-deps, and CJS/ESM public-export smoke checks.

New tests cover both resolution phases, every cause and unknown fallback, aborts, detached delivery, Run/graph plumbing, malicious error properties, invalid classifications, and secret/stack redaction.

Follow-up

SDK first. LibreChat must map its error classes, log through Winston with conversation context, recognize the typed detached failure, and reproduce quarantined/offline workspace startup. This PR does not establish the cause of the October 2 production failures or publish the package.

Review Follow-up

  • C1, P2: preserve resumed-child correlation. Fixed in fa98261e6326a9c40d45fec6b134b09fa34c3bda and carried forward.

  • C2, P2: retain attempted identity for manifest-free forks, aborts, and invalidation without committing or persisting it early. Fixed in 65b7a4dd4f4b8de9e1a3c1befe5880b975798f25; enumeration window completed in 08ddabb8d1ef0df8122775d7fbc15e4d3a028c6c.

  • C3, P2: diagnose replay preparation before tool invocation and return safe parent errors. Cover all resolution entry points, settlement, control flow, and redaction. Fixed in fea72f26f9d8dd75b8bcb88507f6b44a7630f1f1.

  • C4, P2: capture selected identity before checkpoint enumeration rejects. Cover direct execution and replay without early binding; identical captures reuse frozen metadata. Fixed in 08ddabb8d1ef0df8122775d7fbc15e4d3a028c6c.

The latest head passed 608 tests across 26 focused suites, TypeScript, touched-file ESLint/import order, build, circular dependencies, and CJS/ESM Run/graph preflight smoke checks. Independent review completed with no new findings for 08ddabb8d1ef0df8122775d7fbc15e4d3a028c6c; C1–C4 are fixed, with no open or rejected findings. All CI jobs passed.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head: 3d99f1dcf6642b186ec00911a779e8702f1b0402.

Adds host-visible startup diagnostics, closed safe cause mapping, typed detached failures, and version 4.0.2. Passed 332 tests across 11 focused suites, TypeScript, touched-file ESLint/import order, package build, and circular-dependency checks. SDK-only; LibreChat logging and live workspace reproduction follow.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Independent review complete for 3d99f1dcf6642b186ec00911a779e8702f1b0402: no findings at any severity. No fixes or rejections required.

Local verification passed: 332 subagent tests, 203 tracing tests, TypeScript, touched-file ESLint/import order, build, circular dependencies, and CJS/ESM exports. CI passed except Anthropic summarization still running.

Not verified here: LibreChat logger integration or live quarantined/offline workspace reproduction. Production root cause remains unconfirmed. Version 4.0.2 is proposed, not published.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 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-10-04T00:49:40.373644Z 08ddabb 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 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: 3d99f1dcf6

ℹ️ 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 thread src/tools/subagent/SubagentExecutor.ts Outdated
@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head: fa98261e6326a9c40d45fec6b134b09fa34c3bda.

Fixes Codex P2 C1: preserve the resumed child run and branch thread in startup diagnostics. Four new checkpoint-resume regressions; 539 subagent/tracing tests passed. Typecheck/package checks and CI are running. Independent review started for this exact head.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head: 65b7a4dd4f4b8de9e1a3c1befe5880b975798f25.

Addresses P2 C1 and the independent review’s P2 C2 through the identity-preparation invariant. Diagnostics retain the attempted child identity without binding or persisting it early. Expanded coverage includes manifest-free forks, aborts, invalidation, retries, and replacement-record isolation.

Focused tests, TypeScript, touched-file ESLint/import order, build, circular dependencies, CI, and independent review are running for this exact head.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head: fea72f26f9d8dd75b8bcb88507f6b44a7630f1f1.

Fixes P2 C3: route graph replay-preparation failures through the same safe diagnostic and parent-message boundary. Settlement identity failures also retain safe typed errors. Framework interrupts, stream limits, and cancellation remain distinct from ordinary startup failures.

Passed 50 focused diagnostic/identity tests, including real Run/graph preflight paths. Expanded replay-consumer regressions, TypeScript, touched-file ESLint/import order, build, circular dependencies, CI, and independent review are running for this exact head. P2 C1 and C2 remain fixed.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head: 08ddabb8d1ef0df8122775d7fbc15e4d3a028c6c.

Fixes P2 C4: retain the selected persisted identity before checkpoint enumeration can reject. Recording remains diagnostic-only; identical identity attempts reuse the frozen metadata.

Added enumeration-failure regressions for direct execution and graph replay. Passed 52 focused diagnostic/identity tests. Full focused regressions, TypeScript, touched-file lint/import order, build, circular dependencies, CI, and independent review are running for this exact head. C1–C3 remain fixed.

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Independent review complete for 08ddabb8d1ef0df8122775d7fbc15e4d3a028c6c: no new findings. C1–C4 (P2) are fixed; no rejected or open findings.

Passed: 608 tests across 26 focused suites, TypeScript, touched-file lint/import order, build, circular dependencies, and built CJS/ESM diagnostics smoke checks. All CI jobs passed. Codex thread resolved.

SDK 4.0.2 remains proposed, not published. LibreChat logging integration and live workspace reproduction were not run; production causality remains unconfirmed.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review the latest head, final review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 08ddabb8d1

ℹ️ 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 bc5e34b into main Oct 4, 2026
13 checks passed
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.

2 participants