feat(prompts): adopt upstream system-prompt improvements (merged with our customizations)#332
Merged
Merged
Conversation
… our customizations) Fold in genuinely-good, non-conflicting upstream system-prompt guidance landed since the fork point (ed6e5cf) while preserving every Codewith customization. Adopted (merged onto our files): - guardian/policy_template.md: add the connected_account_email evidence bullet for MCP planned actions. Keeps our single-brace {tenant_policy_config} placeholder (our renderer uses string replace, not the upstream {{ }} engine). - web-search/web_run_description.md: add the ## Citations section and drop the weaker trailing "provide links" line, matching upstream. - collaboration-mode-templates/plan.md: clarify handling of Plan-mode follow-ups after a prior <proposed_plan> (incomplete revision vs clarifying question). - tui/prompt_for_init_command.md: do not overwrite an existing init file, adapted to our .codewith/CODEWITH.md branding. Preserved-ours (deliberately not adopted): - The "non-interactive approval modes like never or on-failure" wording in the base/model prompts: upstream removed it while deleting the on-failure approval mode; our fork still ships AskForApproval::OnFailure, so the wording stays. - images.imagegen namespace and the current imagegen guidelines (upstream's rewrite depends on tool params our tool does not expose). - prompts/templates/permissions/approval_policy/on_failure.md and prompts/templates/agents/hierarchical.md: deleted upstream but still include_str!'d by our code. - Codewith/Hasna branding and infinity-agent goal templates are untouched.
andrei-hasna
force-pushed
the
upstream-sync/system-prompts
branch
from
July 20, 2026 16:33
cf93668 to
a9d0751
Compare
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.
What
Adopt genuinely-useful system-prompt / model-facing-instruction improvements that openai/codex landed upstream since our fork point (
ed6e5cf9, 2026-06-07 → upstream/main 2026-07-20, ~1140 commits), merged line-by-line onto our customized prompt files — never a blind overwrite. Every Codewith customization is preserved.This is a model-behavior-affecting "combine". Opened for maintainer review — please do not auto-merge.
Adopted (upstream improvement folded onto our files)
codex-rs/core/src/guardian/policy_template.mdconnected_account_email, use it to judge which account owns a connected destination; don't infer ownership from the connector alone.{tenant_policy_config}placeholder — our renderer usesstr::replace, not upstream's{{ }}engine.codex-rs/ext/web-search/web_run_description.md## Citationssection (markdown-link citation rules + placement); removes the weak trailing "Make sure to provide links" line.codex-rs/collaboration-mode-templates/templates/plan.md<proposed_plan>(incomplete revision vs. clarifying question).codex-rs/tui/prompt_for_init_command.md.codewith/CODEWITH.mdbranding (upstream saysAGENTS.md).Preserved-ours (deliberately NOT adopted)
gpt_5_1_prompt.md,gpt_5_2_prompt.md,prompt_with_apply_patch_instructions.md,protocol/.../base_instructions/default.md,models-manager/prompt.md. Upstream trimmed this to only**never**as part of deleting the on-failure approval mode entirely. Our fork still shipsAskForApproval::OnFailure(protocol/src/protocol.rs), so the wording stays accurate for us — this is a conflict resolved in our favor, not a missed improvement.prompts/templates/permissions/approval_policy/on_failure.mdandprompts/templates/agents/hierarchical.md— deleted upstream, but stillinclude_str!'d by our code (permissions_instructions.rs;prompts/src/agents.rs→core/src/agents_md.rs). Kept.ext/image-generation/imagegen_description.md— upstream rewrote the Guidelines block around new tool params (referenced_image_paths,num_last_images_to_include,view_image) that our tool does not expose (our tool hasactiongenerate/edit +generatedImage(result)). Kept ours, including theimages.imagegennamespace (upstream uses reservedimage_gen).{{ }}templating switch — code-coupled to a templating engine we do not use.prompts/templates/goals/*.md,ext/goal/templates/goals/*.md) — untouched (also unchanged upstream).Out of scope (noted; belongs elsewhere)
Upstream also refactored prompt-building code (
context/*_instructions.rsworld_state migration,collaboration_mode→multi_agent_moderename,code-mode→code-mode-protocolmove). Those are structural code refactors, not prompt-text improvements, and conflict heavily with our fork — they belong in the otherupstream-sync/cluster-*PRs, not here.Verification (warm blacksmith box, whole workspace — never compiled locally)
just check-fast(whole workspace--all): PASS — every crate compiles, so everyinclude_str!'d prompt embeds cleanly.just test-fast(whole workspace--all): 12470 tests, 12401 passed, 22 skipped, 69 failed. All 69 are the known-environmental landlock/seccomp exec-sandbox + process-spawn/external-CLI tests. Verified by test name against the origin/main parent baseline (1442206eb) run on the same box: this PR adds ZERO new failures. The only run-to-run deltas are 6codex-app-server ...background_agent_live::*(worker-process spawn → 10s timeouts) andcodex-hooks fleet_comms::command_*_conversations_cli(absentconversationsCLI), proven flaky by a 3× targeted re-run (fleet_comms flips PASS/FAIL). None relate to the 4 changed markdown files.just clippy(whole workspace--tests): PASS (exit 0).cargo fmt -- --check: PASS (exit 0) on both this branch and the parent baseline. (The diff touches zero.rsfiles —git diff --name-only 1442206eb -- '*.rs'is empty.) Thejust fmt-checkrecipe returns non-zero only from its separatejust --unstable --fmt --checkstep over the justfile itself — a pre-existing main-branch state issue (see the existingstyle/fix-rustfmt-mainbranch), independent of this PR.Secret-scanned (public repo): clean. No
Co-Authored-Bytrailers.