Skip to content

Commit 72090c4

Browse files
committed
docs(review): close deterministic target adoption
1 parent a12a484 commit 72090c4

5 files changed

Lines changed: 53 additions & 9 deletions

File tree

docs/en/release-notes/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ GitHub Releases page; `0.8.0` is the new starting line.
1717

1818
## Unreleased
1919

20+
- **Reviewer subagents now receive deterministic Git scopes.** Structured automatic,
21+
uncommitted, base, and commit targets resolve to full commit anchors before dispatch, reject
22+
invalid or empty scopes explicitly, and keep repository metadata isolated from instructions
23+
across foreground and background runs.
2024
- **Parallel streamed tool calls are now correlated safely.** Interleaved argument chunks stay attached to their indexed calls, malformed or truncated call streams stop before tool execution, and failed attempts are not retried after output has already been shown.
2125
- **Provider compatibility and Z.AI routing are now explicit.** Immutable compatibility profiles keep request-format quirks behind the chat-provider boundary, while independent Z.AI Coding Plan and API login routes use separate credentials, endpoints, model identities, catalog refresh, logout, and usage/rate-limit state. Curated GLM requests now apply exact context/output limits, thinking controls, reasoning replay, and tool-stream support without activating for local or unknown models.
2226

docs/superpowers/specs/2026-07-15-review-target-resolution-design.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Deterministic reviewer target resolution design
22

3-
**Status:** Approved on 2026-07-15
3+
**Status:** Implemented; feature verified, repository gate baseline-blocked on the clean-main PTY
4+
Escape test (2026-07-15)
45

56
## Problem
67

tasks/agent-harness-adoption-plan.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ generic pythinker agent enhancements — no external product names in code, comm
4848

4949
**Files.** `src/pythinker_code/ui/print/__init__.py`, `<ref>/exec/src/lib.rs`
5050

51-
### `review-mode/deterministic-review-target-resolution-and-prompt-synthesis` — partial, S, high
52-
53-
**Today.** The standalone review engine resolves diffs deterministically with base/staged/working-tree/range modes, fallback refs, and a fallback audit trail (packages/pythinker-review/src/pythinker_review/engine/diff_source.py). But agent-mediated review dispatch leaves git scoping entirely to the model — system.md only instructs it prose-style to compute the merge base (src/pythinker_code/agents/default/system.md:120), and git-context injection is gated to explore subagents only (src/pythinker_code/subagents/core.py:90).
54-
55-
**Verifier note.** Claim CONFIRMED as stated; all three cited anchors verified. The standalone engine is deterministic; the agent-mediated path has no deterministic diff scoping anywhere — the review/code-reviewer subagent specs receive scope purely via the parent's prompt text.
51+
### `review-mode/deterministic-review-target-resolution-and-prompt-synthesis` — done, S, high
52+
53+
**Today.** Done. `src/pythinker_code/subagents/review_target.py` resolves structured auto,
54+
uncommitted, base, and commit targets before child allocation. `subagents/core.py` composes generic
55+
Git context, the caller task, and the authoritative target in that order and revalidates live
56+
`HEAD`; the Agent/RunAgents and background manager/runner paths preserve the requested and resolved
57+
target plus its safe hint across foreground and background execution.
58+
59+
**Verifier note.** DONE. Resolver, malformed/empty/failure, merge, fallback, and drift behavior is
60+
pinned by `tests/subagents/test_review_target.py`; prompt ordering and resume behavior by
61+
`tests/core/test_prepare_soul.py`; tool schema, foreground, and mixed-batch transport by
62+
`tests/tools/test_agent_tool.py`; and background persistence/transport/failure by
63+
`tests/background/test_manager.py` and `tests/background/test_task_metadata.py`.
5664

5765
**Adopt.** Add a small resolver (target -> prompt + hint) that precomputes the merge-base SHA via the async git helper and renders one of three template prompts (uncommitted / base-branch-with-sha + backup variant / commit-with-title), then prepend it to the review subagent's prompt at dispatch. Also extend collect_git_context injection in subagents/core.py to reviewer-class agents so every review run starts with branch, dirty files, and merge-base already in context instead of burning turns rediscovering them.
5866

tasks/lessons.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Format: trigger → rule.
55

66
## Subagent orchestration
77

8+
- **When testing that subagent preparation failed before a prompt snapshot was written**, assert
9+
that `prompt.txt` remains empty rather than absent — `SubagentStore` intentionally pre-creates
10+
instance files during allocation, so path existence is not evidence of a snapshot write.
11+
812
- **When dispatching subagents whose results you will immediately synthesize**
913
(review + report, parallel analysis with no interleaved work), use
1014
**foreground fan-out** (`RunAgents` foreground mode) — results return inline,

tasks/todo.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,42 @@
99
- [x] Review and approve
1010
`docs/superpowers/specs/2026-07-15-review-target-resolution-design.md`.
1111
- [x] Write the implementation plan with TDD and verification checkpoints.
12-
- [ ] Implement the approved plan in the isolated feature worktree.
13-
- [ ] Add the required `CHANGELOG.md` Unreleased entry.
14-
- [ ] Run focused tests, `make check-pythinker-code`, `make test-pythinker-code`, and final review.
12+
- [x] Implement the approved plan in the isolated feature worktree.
13+
- [x] Add the required `CHANGELOG.md` Unreleased entry.
14+
- [x] Run focused tests, `make check-pythinker-code`, `make test-pythinker-code`, and final review.
1515

1616
Acceptance: every fresh reviewer receives one pre-resolved authoritative Git target; invalid or
1717
empty explicit targets fail before child allocation; `Agent` and per-child `RunAgents` behavior is
1818
identical across foreground and background execution; generic Git context cannot contradict the
1919
resolved target; non-reviewer and resume behavior remains compatible.
2020

21+
#### Review: deterministic reviewer target resolution
22+
23+
- **Outcome:** structured auto, uncommitted, base, and commit targets now resolve before reviewer
24+
allocation; foreground, per-child batch, and background paths preserve the requested and resolved
25+
target and fail explicitly at the appropriate boundary.
26+
- **Reviewed range:** `10aedf26..a12a4840` (seven branch commits, from the design checkpoint through
27+
the amended failure-boundary hardening commit).
28+
- **Focused verification:** the exact 11-file feature set passed `289 passed, 1 warning in 14.43s`.
29+
- **Static verification:** `make check-pythinker-code` passed with Ruff clean, `1262 files already
30+
formatted`, Pyright `0 errors, 0 warnings, 0 informations`, and ty clean.
31+
- **Repository test gate:** `make test-pythinker-code` remains red solely at
32+
`tests/e2e/test_shell_pty_e2e.py::test_shell_cancel_running_command_kills_process_and_recovers`:
33+
`1 failed, 7131 passed, 9 skipped, 1 xfailed, 5 warnings in 379.30s`, before the separate
34+
`tests_e2e` phase. The isolated branch node also failed because Escape was ignored and the command
35+
completed; the identical isolated node fails on clean `main`, proving this is a baseline,
36+
out-of-scope blocker rather than a feature regression.
37+
- **Remaining branch verification:** excluding only that baseline node passed `7131 passed, 9
38+
skipped, 1 deselected, 1 xfailed, 5 warnings in 325.71s`; the separate `tests_e2e` suite passed
39+
`65 passed, 4 skipped, 1 warning in 89.35s`. `git diff --check` was silent.
40+
- **Review verdict:** final implementation review after `a12a4840` found no Critical, Important, or
41+
Minor findings; C01/C03/C05/C06/C08/C12/C13/C14/C15 all passed; ready to merge: yes.
42+
- **Approved limitation:** uncommitted/base scopes pin `HEAD` and revalidate it immediately before
43+
execution, but the index and worktree remain explicitly live. The feature does not claim an
44+
immutable patch snapshot.
45+
- **Blocker:** the repository-wide package test gate is blocked solely by the reproducible
46+
clean-main PTY Escape failure above. No feature-owned failure remains.
47+
2148
### TUI thinking Markdown and activity motion (2026-07-11)
2249

2350
- [x] Execute `docs/superpowers/plans/2026-07-11-tui-thinking-markdown-and-activity-motion.md`

0 commit comments

Comments
 (0)