fix(chat): Keep prompt context causal#412
Merged
Merged
Conversation
Remove trace and conversation identifiers from user prompt text so the model only sees causal thread context and the current instruction. Keep span message attributes faithful to the actual model transcript instead of display-cleaning them. Add regression coverage for avoiding duplicated thread context when Pi history is already present and for preserving chat input text in GenAI span attributes. Supersedes GH-404 Co-Authored-By: OpenAI GPT-5 Codex <codex@openai.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8c42537. Configure here.
Remove a redundant guard after the early return in buildUserTurnText. This keeps the prompt behavior unchanged while addressing review feedback. Co-Authored-By: OpenAI GPT-5 Codex <codex@openai.com>
Expose the active trace id through the per-turn runtime context so the bot can look up its own debug information. Keep it out of buildUserTurnText so the current instruction wrapper only contains causal thread context and user text. Co-Authored-By: OpenAI GPT-5 Codex <codex@openai.com>
Clarify that thread background and current instruction are top-level sibling blocks in the user message, not nested runtime metadata. This keeps the prompt shape simple while preserving the existing delimiter boundaries. Co-Authored-By: OpenAI GPT-5 Codex <codex@openai.com>
Remove internal model, channel, and Slack capability fields from the model-visible runtime context. Keep the conversation id and trace id so the agent can correlate its own turn with telemetry and debug data. Co-Authored-By: GPT-5 Codex <gpt-5-codex@openai.com>
Remove the broader span transcript policy changes from this prompt-context PR. The remaining tests focus on the prompt context invariants changed by the branch. Co-Authored-By: GPT-5 Codex <gpt-5-codex@openai.com>
Skip empty capabilities, context, and runtime sections in the turn prompt. Keep runtime context limited to the conversation and trace identifiers that help the agent correlate its own turn with telemetry. Co-Authored-By: GPT-5 Codex <gpt-5-codex@openai.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Keep model-visible prompt context causal and non-duplicative. This supersedes GH-404 by fixing prompt assembly instead of cleaning span payloads for display.
Runtime Context
User turns keep causal runtime identifiers in
<runtime-turn-context>, includinggen_ai.conversation.idand the activetrace_id, so the bot can correlate its own turn with telemetry and debug data. Internal model names, synthetic channel labels, Slack capability summaries, thinking-level routing metadata, runtime version, and duplicate sandbox paths are no longer exposed in the prompt.Prompt Shape
Empty capabilities, context, runtime, and loaded-skill blocks are omitted instead of emitted as placeholder markup. When thread background is needed, it remains a top-level sibling block next to the current instruction.
Thread History
When Pi history already carries prior messages, the fresh prompt continues to omit the Slack transcript background so previous user messages are not duplicated.
Supersedes GH-404