Skip to content

docs(integrations): describe the gateway's inferred conversation identity - #2834

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:docs/gateway-inferred-conversation
Nov 27, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:docs/gateway-inferred-conversation

Conversation

@Fengzdadi

Copy link
Copy Markdown
Collaborator

Which issue or RFC does this PR close?

Part of #2250.

Rationale for this change

#2813 makes a combined gateway (PC_GATEWAY_CORE_UDS) infer a conversation for a request that carries no conversation header. history_conversation_id in gateway/crates/pc-gateway-app/src/ingress.rs derives an ID from the model, the instructions and the messages up to the first user message, when the request carries the full history: no previous_response_id or conversation, and a non-empty first user message preceded only by system or developer messages. The ID is process-local (history:{route}:…, hashed with a per-process seed). A combined deployment now injects by default when it has either an explicit or an inferred ID. The inferred ID is used only for preparation replay; capture and prefix extraction still use the header identity (run_with_replay_identity in executor.rs).

The LangChain, LangGraph, Deep Agents, Pydantic AI, OpenClaw and Dify guides still said that a combined deployment injects only into requests with X-PowerContext-Conversation-ID, and the OpenClaw guide required PC_GATEWAY_INJECTION=on because OpenClaw sends no usable header. Both statements are wrong after #2813. The deploy-server guide already describes the new rule in "Gateway context injection".

What changes are included in this PR?

Docs only, in docs/en and docs/zh.

  • integrations/{langchain,langgraph,deepagents,pydantic-ai}.md: the conversation-header paragraph of each gateway section now says that, without the header, a combined deployment infers the conversation from the opening of the request, and why the host's requests qualify by default:
    • ChatOpenAI sends the thread's full history on every call unless use_previous_response_id=True (LangChain, LangGraph, Deep Agents).
    • Pydantic AI sends the full message history unless openai_previous_response_id or openai_conversation_id is set.
    • Deep Agents: a subagent task starts a new history and gets its own inferred conversation; a subagent with mode: "fork" carries the parent's history and shares its inferred conversation.
    • What the header still adds: it keeps apart conversations that open the same way, and gives capture and prefix extraction a conversation identity that survives gateway restarts.
    • A standalone gateway (PC_GATEWAY_CORE_BASE) injects only with PC_GATEWAY_INJECTION=on.
  • integrations/openclaw.md: the bullet that required PC_GATEWAY_INJECTION=on now says that a combined deployment infers the conversation, because on a custom provider OpenClaw 2026.8.1 sends the session's full history opening with its system prompt and the first user message; that sessions with the same system prompt and first message share an inferred conversation; and that a standalone gateway still needs PC_GATEWAY_INJECTION=on. The warning against a fixed X-PowerContext-Conversation-ID in the provider's headers stays.
  • integrations/dify.md: the injection sentence now gives the general rule: a combined deployment injects when it identifies the conversation from a recognized header or from the opening of a full-history request; PC_GATEWAY_INJECTION=on prepares an unidentified request on its own; a standalone gateway injects only with that setting.

Each passage links "Gateway context injection" in operate/deploy-server.md instead of restating it.

Are there any user-facing changes?

Documentation only. No code, API, configuration default or persisted-format changes.

How was this change tested?

  • prek run --files on the twelve changed files (offline).
  • pnpm check:links in website/ (offline install): links and anchors in 379 public pages and 671 repository files.
  • The gateway statements were checked against fix(gateway): replay context for headerless conversations #2813's code (942e61f): history_conversation_id, the injection default and the skip log in ingress.rs, and run_with_replay_identity in executor.rs.
  • The host statements come from reading the installed sources, not from running the hosts:
    • langchain-openai 1.6.0: ChatOpenAI request construction and use_previous_response_id.
    • Pydantic AI 2.64: the OpenAI model's message mapping, instructions, openai_previous_response_id and openai_conversation_id.
    • Deep Agents: the task tool's subagent message and mode: "fork" history.
    • OpenClaw: @openclaw/ai 2026.8.1 dist/transports.mjs (resolveResponsesContinuationRequest uses previous_response_id only for OpenAI's own Responses endpoint with store: true) and the shared Responses mapping that sends the system prompt as the first message item.
  • Not checked: whether OpenClaw's system prompt stays byte-identical across the requests of a session (a change only makes the gateway prepare again), OpenClaw's history after compaction, and Dify's model-provider request shape (no Dify source or run).
  • No gateway run: an offline build of the gateway on current master needs crates that are not in the local cache.

AI usage statement

This PR was prepared with Claude Code (Claude Opus 5.5): reading the gateway and host SDK sources, and writing the documentation text. A second Claude Code session reviewed the diff before the PR was opened.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 2505cd7. The bilingual documentation update matches the gateway distinction between inferred preparation-replay identity and explicit capture/prefix identity. No blocking findings, new database tables, migrations, or interfaces. Documentation CI is green. Host execution and real-provider end-to-end acceptance were not performed for this docs-only change.

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@hidb4ai
hidb4ai merged commit 883af5d into oceanbase:master Nov 27, 2026
43 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.

3 participants