[pull] main from danny-avila:main#135
Merged
Merged
Conversation
…rter) (#303) * feat(openai): persist GPT-5.6 Responses state (inherit upstream converter) Slim reimplementation of #301. Keeps the genuinely fork-specific deltas — managed prompt-cache breakpoints (prompt_cache_options + breakpoint injection), safety_identifier, cache-write usage metadata, and the encrypted-reasoning `include` request (shouldIncludeEncryptedReasoning) — but INHERITS @langchain/openai's convertMessagesToResponsesInput for the reasoning replay / encrypted_content / response.output reuse instead of forking it, avoiding permanent converter parity divergence. Breakpoints are injected over upstream's converter output at completionWithRetry; cache-write is surfaced by thin _generate/ _streamResponseChunks wraps over super. Bumps @langchain/openai to 1.5.5. Co-authored-by: Joseph Licata <usnavy13@users.noreply.github.com> * fix: address Codex review on GPT-5.6 managed cache - Responses breakpoints: only mark input_text/input_image/input_file blocks (output_text/refusal are rejected 400 on replayed assistant turns), and handle string message content by wrapping it in an input_text breakpoint block. Mirrors the Chat Completions breakpoint robustness. - Drop `npm run build` from the `prepare` script — npm runs prepare during `npm pack`, which the publish workflow runs after `npm prune --production`, so the build would fail with dev deps removed. * fix: address Codex round-2 review on GPT-5.6 managed cache - Never select assistant/tool turns for Responses breakpoints (role gate); input_text under role:assistant is rejected 400. Fixes a regression from the round-1 string-content wrapping. - Guard missing input_tokens_details with optional chaining so non-cache Responses/Azure usage (top-level counts only) doesn't throw. - Expose promptCacheExplicit/safety_identifier on Azure options via a shared ManagedRequestOptions type (the Azure wrappers read them). - Bump declared @langchain/core to ^1.2.2 to match @langchain/openai 1.5.5's peer floor. --------- Co-authored-by: Joseph Licata <usnavy13@users.noreply.github.com>
…ng (#304) * 🧭 feat: Replay Steer Parts as User Turns in formatAgentMessages Hosts persisting mid-run steers as inline `steer` content parts had no replay path: the part fell through formatAssistantMessage's catch-all into the assistant's provider content on every later turn. Add ContentTypes.STEER and a dedicated branch that flushes accumulated assistant content, then reconstructs the steer as a standalone HumanMessage (role/source kwargs matching convertInjectedMessages). When the host stamped a pre-encoded `media` content array on the part, the HumanMessage is multimodal — attachment refs are re-encoded per turn host-side, mirroring regular user media. `lastAIMessage` is not reset, so post-steer tool steps keep valid provider ordering. * 🧷 fix: Close Mid-Flight Hook-Registration Races on the Eager Path Codex round 2 (3 P2s), all consequences of the dynamic hook scan: - Snapshot hasPostHook/hasFailureHook at dispatch start beside the early-emission gate: a result-altering hook registered while a batch is in flight applies from the NEXT batch, so an early completion and the final ToolMessage can never show two versions of one output. - blockEntry deletes the call's prestarted eager record: a call the run reports as blocked can neither be consumed nor emit its pending eager completion (dispatchEagerToolCompletions' map-identity check). - isBatchSensitiveToolExecution resolves the hook-session id the way ToolNode will (metadata.run_id ?? configurable.run_id ?? graph.runId) so subagent child streams gate on the parent run's hooks instead of the child graph id. * 🩹 fix: Re-Emit Corrected Completions for Hook-Rewritten Eager Results Codex P2 on the merged injectedMessages PR: when the stream emitted a raw eager completion and a result-altering hook registered before the batch consumed the record, the batch trusted `completionDispatched` and suppressed the corrected emission — host/UI step output diverged from the rewritten ToolMessage. The consumed record is now treated as not-dispatched whenever the batch-start hook snapshot shows result-altering hooks, forcing a corrected batch-time re-emission. * 🎛️ fix: Exact Run-Id Source, Steer Anchor Reset, Precise Eager Corrections Codex round on the follow-up PR (4 P2s): - The stream prestart gate reads `configurable.run_id` FIRST — the only source ToolNode's hook lookups use — with metadata/graph.runId as conservative fallbacks. - `formatAssistantMessage` resets the assistant anchor after emitting a steer HumanMessage: a post-steer tool_call mints a fresh AIMessage (heal path) instead of attaching to the pre-steer anchor, which produced AI(call), Tool, Human, Tool — an invalid provider ordering. - The corrected-completion override fires only when a hook can actually rewrite the consumed result (PostToolUse + non-error result); failure hooks cannot replace output, so no duplicate emission. - Prestarted eager records are pulled from the map BEFORE PreToolUse hooks are awaited (restored on allow), so an async deny can no longer race the eager host promise into emitting a successful completion. * 🎯 fix: Rewrite-Keyed Re-Emission and Reasoning-Safe Steer Replay - The corrected-completion re-emission now keys on the ACTUAL rewrite: `eagerCompletionDispatchedIds` is un-marked exactly where a PostToolUse hook returns `updatedOutput`, so observe-only/context-only hooks leave the original eager emission final (no duplicate completions), while real rewrites still converge host/UI output to the ToolMessage. - The steer replay branch flushes pending reasoning before emitting the user turn: reasoning directly preceding a steer (DeepSeek / preserveReasoningContent) now lands on an anchor AIMessage instead of silently vanishing when no other content triggers a flush. * 🧬 fix: Steer Boundary Hygiene for Reasoning and Multi-Agent Labeling Codex round on the follow-up PR: - The steer branch resets reasoning state after the user turn (the steer splits the assistant message; the post-steer segment starts fresh) — pinned by a [THINK, STEER, TEXT] replay test showing the trailing text exactly once with no pre-steer reasoning bleed. - Both agent-content labelers pass steer parts through verbatim: user speech is never agent content, so folding it into a labeled transfer or parallel summary would drop the words AND misattribute them; the pass-through keeps them replayable as user turns. - Paired Anthropic server-tool use/results deliberately co-emit in the post-steer segment (splitting the pair across the user turn is invalid for the provider; unpaired uses already drop at the boundary via the meaningful-content rule) — behavior now pinned by a test. * 🚪 fix: Close Open Transfer Captures at Steer Boundaries Codex P2: a steer landing between an lc_transfer_to_* call and the transferred agent's content left the capture live (flushAgentBuffer no-ops on an empty buffer), so post-steer agent content folded into the PRE-steer transfer output — replayed as a ToolMessage ahead of the user's redirect and removed from after it. The steer pass-through now explicitly resets the transfer capture; post-steer content stays inline after the user turn. Pinned by a transfer→steer→content test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )