Skip to content

fix(chat): Keep prompt context causal#412

Merged
dcramer merged 7 commits into
mainfrom
fix/prompt-transcript-context
May 23, 2026
Merged

fix(chat): Keep prompt context causal#412
dcramer merged 7 commits into
mainfrom
fix/prompt-transcript-context

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented May 23, 2026

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>, including gen_ai.conversation.id and the active trace_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

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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment May 23, 2026 8:42pm

Request Review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread packages/junior/src/chat/respond-helpers.ts
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>
@dcramer dcramer changed the title fix(chat): Keep prompt transcripts faithful fix(chat): Keep prompt context causal May 23, 2026
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>
@dcramer dcramer merged commit c2ebec1 into main May 23, 2026
16 checks passed
@dcramer dcramer deleted the fix/prompt-transcript-context branch May 23, 2026 21:54
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.

1 participant