Repository navigation
feat: preserve host model invocation context through output protection - #704
Conversation
|
@codex review Please review the current PR head c14bfb8. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads. Please check callback confidentiality, per-invocation context isolation and backward compatibility of the optional host service argument. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Provider-text protection intentionally withholds the raw callback manager from the underlying model. That also removed the model run ID needed by remote host-model services to correlate input admission with the SDK graph. Preserve a small, read-only invocation context independently of callbacks so both protections can compose.
HostModelService.invokeandstreamaccept an optional third argument,{ version: 1, runId }.HostChatModel.invocationContextVersion = 1advertises support. An internal WeakMap associates context with the exact protected options object; it adds no provider parameters and uses no ambient async context. Raw output callbacks remain suppressed. Two-argument services keep working, and direct low-level calls without a native invocation have no inferred identity.Related to LibreChat-AI/LibreChat#18271. This is SDK source only: no version bump, tag, or publication. Release work remains separate.
Validation
npx tsc --noEmit, scoped ESLint/import sorting, production CJS/ESM/declaration build and circular-dependency check passed.Contract and limits
The run ID is correlation only, never authorization. Transports still authenticate execution identity, verify root callback lineage, negotiate support and own cancellation/recovery. This does not automatically wire product policy, billing or tracing. The corresponding LibreChat adapter is stacked on #18271 and will negotiate the additive capability during rollout.