Skip to content

fix(cli): snapshot apply writes a text candidate's prompt - #1152

Merged
Birfy merged 1 commit into
mainfrom
fix/1149-snapshot-apply-text
Nov 17, 2026
Merged

Birfy merged 1 commit into
mainfrom
fix/1149-snapshot-apply-text

Conversation

@Birfy

@Birfy Birfy commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

#1138 made a snapshot the complete candidate, and for a text run that candidate is rendered. snapshot eval already scores that text, but snapshot apply materialised files (the strategy's internal rule store) into a temp directory and handed it to apply_from_payload's tree path. A user who named a file got a directory of hash-named rule files, and an empty-rules snapshot reported a no-op instead of writing the seed prompt.

cmd_snapshot_apply now writes snap.render() to a temp file when kind == \"text\" and passes that file to apply_from_payload, so the text plan, .bak-N backup, no-op detection, and parent creation apply. A directory --to is refused with an error naming FILE. Tree-kind snapshots keep the materialise path.

Closes #1149.

Tests

  • tests/test_snapshot_cli.py::test_snapshot_show_export_eval_and_apply: text fixture now pins --to missing.txt writes exactly rendered, a second apply is noop: true, a directory --to is refused, and an empty-rules snapshot writes the seed prompt. Tree assertions move to a skill_dir snapshot.

Checklist

  • Changelog fragment changelog.d/1149-snapshot-apply-text.md
  • No new dependencies
  • No Cursor Cloud Coding Sessions

Verification at the tip

Tip SHA: 8e983aa

Ran:

  • pytest -q tests/test_snapshot_cli.py tests/test_snapshot.py tests/test_text_kind_dir_target.py
  • python -m tools.changelog_fragments check
  • the issue's offline repro now writes the rendered prompt to prompt.txt (exit 0, noop: false)

Not run:

  • full pytest -q — the CI test matrix is the line
  • Ark real-model run — no model path changed

@Birfy

Birfy commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Review (Birfy)

Tip SHA: 8e983aa
Ran:

  • .github/scripts/risk_gate.py --pr 1152 → T2 (83 lines / 3 files)
  • pytest -q tests/test_snapshot_cli.py tests/test_snapshot.py tests/test_text_kind_dir_target.py → passed
  • python -m tools.changelog_fragments check → 71 changelog fragment(s) OK
  • the issue's offline repro at this tip → writes the rendered prompt to prompt.txt (exit 0, noop: false); prompt.txt is a file
    Not run:
  • Full offline suite locally — the CI test matrix is the line
  • Ark real-model run — no model path changed
    Findings:
  • none.
    Verdict: PASS

@Birfy
Birfy enabled auto-merge (squash) November 17, 2026 22:24
@Birfy
Birfy merged commit 7e5fd0a into main Nov 17, 2026
10 checks passed
@Birfy
Birfy deleted the fix/1149-snapshot-apply-text branch November 17, 2026 22:44
HugoXK added a commit that referenced this pull request Nov 18, 2026
Forward-merge after #1138/#1140/#1139/#1147/#1148/#1151/#1152 landed.
#1148 rewrites agentdescent/pilot.py, the file this branch patches; the
auto-merge keeps both the per-seed _next_actions branch and the
notes/strategy card addition, and the focused set is green at the
merge tree.
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.

bug(snapshot): apply writes a text candidate's rule store, not its prompt

1 participant