fix(approval): turn-boundary deliberation one-shot + destructive-tool registry - #56
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces generation-scoped deliberation context to make destructive-action one-shot bouncing aware of execution context and generation identity. The feature unifies context-specific approval fingerprinting with per-generation bounce tracking, allowing the same destructive call to be approved in a later generation even if it was rejected in an earlier one. ChangesDeliberation Scoping for Context-Aware One-Shot Approval
Sequence DiagramsequenceDiagram
participant PythinkerSoul
participant deliberation_scope as deliberation_scope CM
participant Core as pythinker_core.step
participant Approval
participant ApprovalState
PythinkerSoul->>PythinkerSoul: increment _deliberation_generation
PythinkerSoul->>PythinkerSoul: compute deliberation_context_id
PythinkerSoul->>deliberation_scope: enter(context_id, generation)
Note over deliberation_scope: Bind DeliberationScope to ContextVar
deliberation_scope->>Core: execute pythinker_core.step(...)
Core->>Approval: may invoke destructive actions
Approval->>deliberation_scope: read active DeliberationScope
Approval->>Approval: compute fingerprint(context_id, tool_name, args)
Approval->>ApprovalState: check deliberated_fingerprints[fingerprint]
alt Same generation duplicate
ApprovalState-->>Approval: generation matches
Approval-->>Core: return rejection (bounce)
else Later generation in same context
ApprovalState->>ApprovalState: record new generation, delete old
Approval-->>Core: return None (allow once)
else Earlier generation or unscoped
ApprovalState-->>Approval: prior bounce recorded
Approval-->>Core: return rejection (bounce)
end
Core-->>deliberation_scope: return StepResult
deliberation_scope->>deliberation_scope: await tool_results (scope bound)
deliberation_scope-->>PythinkerSoul: exit scope
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Related Issue
None linked. Implements M5 + M6 from
docs/superpowers/plans/2026-06-02-deliberation-turn-boundary.md.Description
This PR fixes auto-deliberation turn-boundary handling for destructive actions.
Covers:
DeliberationScopeContextVar primitiveauto_deliberateone-shot handling## UnreleasedVerification
uv run pytest tests/ -q -p no:cacheprovider --ignore=tests/e2e --ignore=tests/aiuv run pyrightuv run ruff check .uv run ruff format --check .uv run pytest tests/core/test_approval_auto.py::test_same_generation_duplicate_destructive_calls_both_bounce tests/core/test_approval_auto.py::test_subagent_identical_call_does_not_consume_main_one_shot -vcd docs && npm run sync## Unreleasedlinesuv run pytest tests/test_release_update_pipeline.py::test_changelog_workflow_skips_release_prep_prs -qgit diff --checkChecklist
cd docs && npm run syncSummary by CodeRabbit
New Features
Documentation