Skip to content

feat(core): state the environment once in the prompt and pin it with a golden file - #491

Merged
lg2m merged 2 commits into
mainfrom
feat/plan-e-prompt
Oct 29, 2026
Merged

lg2m merged 2 commits into
mainfrom
feat/plan-e-prompt

Conversation

@lg2m

@lg2m lg2m commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Change

Plan section E. The agent prompt moves to version 27.

  • One Environment section states what tool descriptions used to repeat:

    • the workspace root is the user's real checkout, with tool paths relative to it;
    • commands run as the user, with their environment, credentials and network;
    • changes apply immediately;
    • whether there is a snapshot for qq undo (session root in a Git checkout);
    • the session's mode, including Ask with no one to approve;
    • the fixed stops (Ask and Auto);
    • what a permission_denied: result means.

    Sub-agents are told they work within their parent's authority and under the parent's snapshot. The absolute path stays out of the prompt (fix(core): keep the system prompt identical across task workspaces #459).

  • "may require user approval", "approval gate", "declared policy" and "host supplies" are gone. The spawn_agent, read_file, exec, fetch and ask_user descriptions now say only how to use the tool. exec stays consistent with feat(core): let long shell commands yield and follow them with command_status #488 (yield_after_seconds, command_status), including the variant used without shell.

  • The nested-instructions bullet shrinks from about 1.3 KB to one sentence.

  • A final-answer bullet: lead with the outcome, keep it short, cite path:line. In Auto, take an in-scope next step instead of offering it. Sub-agents keep their own reply shape.

  • crates/qq-core/tests/golden/root_prompt.txt pins the full root prompt. QQ_UPDATE_GOLDENS=1 rewrites it, the same variable the TUI goldens use; no new dependency.

The session's mode and snapshot flag now feed PromptPrefixKey, so the compaction summarizer still shares the prompt runs' cache prefix. The schema, descriptor and prompt-version pins are updated, and the historical v14 reconstruction gains a v27 reversal step. docs/design/tools.md is updated. In docs/plans/README.md, section E now holds only its acceptance criterion.

Verification

  • New tests: the_root_prompt_matches_its_golden, the_environment_states_mode_snapshot_and_stops, a_write_child_defers_to_its_parent_and_its_snapshot, a_run_without_tools_has_no_environment.
  • cargo xtask check: passed on 906c329 (fmt, lint, clippy, all 7 affected packages' tests).
  • A review against approval.rs, sessions/approvals.rs and undo.rs found four wrong claims in an earlier draft (Full, Ask, write-child mode, write-child snapshot). All four are fixed and tested.

Known impact

  • Whether a snapshot exists is decided at plan compile by finding .git in the workspace or an ancestor, not by git rev-parse as undo::discover does. A missing git binary, or git init while a plan is cached, can make that line wrong. A failed snapshot is still logged.
  • Acceptance is still unmeasured: the plan's six tasks must show no more end-of-run offers or questions than v0.1.9, Claude Opus included.
  • Two goal tests (closing_goal_host_drains_accepted_work_without_admitting_successors, loading_exhaustion_without_work_blocks_after_three_attempts) timed out once under full parallel load. Both pass alone and on origin/main.

lg2m added 2 commits October 28, 2026 18:33
…a golden file

Prompt 27. One Environment section says the workspace root is the user's
checkout, commands run as the user with their environment and network,
changes apply immediately, whether the run is snapshotted for qq undo,
the session's mode, the fixed stops, and what a permission_denied result
means. Approval and policy wording leaves the tool phrases and the
spawn_agent, read_file, exec, fetch and ask_user descriptions. The nested
instruction bullet shrinks to one search. A final-answer bullet asks for
the outcome first with path:line citations, and in Auto to take an
in-scope next step instead of offering it.

crates/qq-core/tests/golden/root_prompt.txt holds the full root prompt;
QQ_UPDATE_GOLDENS=1 rewrites it.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T02:03:42.795246Z 906c329 PR opened
ℹ️ 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.

@lg2m
lg2m merged commit 2ca8c01 into main Oct 29, 2026
7 checks passed
@lg2m
lg2m deleted the feat/plan-e-prompt branch October 29, 2026 02:08
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