Skip to content

fix(core): keep the system prompt identical across task workspaces - #459

Merged
lg2m merged 1 commit into
mainfrom
fix/prompt-cache-root
Oct 25, 2026
Merged

lg2m merged 1 commit into
mainfrom
fix/prompt-cache-root

Conversation

@lg2m

@lg2m lg2m commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

The first line of the system prompt named the absolute workspace root. Under Auto on Linux, each run executes in its own task-workspaces/<run_id> directory, so every new run in a session sent a different system prompt. The system prompt is the head of every provider's cached prefix (Anthropic, Bedrock, OpenAI, xAI), so each run re-paid its tools, instructions and whole history as uncached input. Tools already reject absolute paths, so the model gained nothing from the path.

The header now reads "You are QQ, a coding agent operating in a workspace." The unused workspace parameter is removed from the prompt builders. The prompt version moves to 23; the earlier descriptor goldens pin prompt 22 explicitly.

First PR in a stack of prompt-cache fixes (next: budget-final notice as a message, then a session cache key for OpenAI Responses and xAI).

Verification

  • New test plan::tests::the_system_prompt_is_identical_across_workspace_locations failed before the fix and passes after. It compiles the same plan at two directories and requires byte-identical prompts.
  • Real binary with the verify-qq fake provider: two qq run --approval auto runs in one session, in two different task directories.
    • Before: request 0 …/task-workspaces/93b59ec7… vs request 1 …/task-workspaces/f86f41c9…. Only the instructions differed.
    • After: the instructions and tools are byte-identical, and both runs report system_prompt_hash 5fde0b3c… at prompt version 23.
  • cargo xtask check passes. Two lines in xtask/src/legacy-sleeps.txt moved by one line because of the edits in lib.rs; no new sleeps.

Known effects

The prompt hash changes for every route, so the first request after upgrading is a one-time cache miss.

@lg2m

lg2m commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T20:41:48.962228Z 4791c47 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: a1b84476f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

@lg2m
lg2m force-pushed the fix/prompt-cache-root branch from a1b8447 to 4791c47 Compare October 24, 2026 20:14
@lg2m

lg2m commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 4791c47a2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

@lg2m
lg2m merged commit b2c4dcf into main Oct 25, 2026
7 checks passed
@lg2m
lg2m deleted the fix/prompt-cache-root branch October 25, 2026 00:11
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