Skip to content

feat: improve auto-mode TUI rendering and reviewflow validation - #61

Merged
elkaix merged 10 commits into
mainfrom
feat/auto-mode-tui-rendering
Jun 2, 2026
Merged

feat: improve auto-mode TUI rendering and reviewflow validation#61
elkaix merged 10 commits into
mainfrom
feat/auto-mode-tui-rendering

Conversation

@elkaix

@elkaix elkaix commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • improve TUI transcript/tool rendering, changelog display, ReadSkill rendering, and session recap wording
  • add Reviewflow prompt manifests, evidence/drop validation, prompt-file guidance, and provider rate limiting
  • share security-scan framework/slug knowledge and prioritize processing order

Verification

  • uv run pytest tests/test_session_recap.py tests/ui_and_conv/test_tui_card_tool_renderers.py tests/ui_and_conv/test_shell_slash_commands.py tests/ui_and_conv/test_live_view_notifications.py tests/ui_and_conv/test_tui_blocks_integration.py tests/ui_and_conv/test_visualize_running_prompt.py tests/e2e/test_shell_modal_e2e.py tests/e2e/test_shell_pty_e2e.py -q
  • uv run pytest tests/ui_and_conv/test_md_table_contract.py -q
  • uv run --directory packages/pythinker-review pytest tests/unit/test_reviewflow.py tests/e2e/test_reviewflow_workflow.py tests/unit/test_security_scan.py tests/unit/test_signals.py -q
  • make check-pythinker-code
  • make check-pythinker-review (ruff/format/pyright passed; ty remains non-blocking and printed existing diagnostics)

Summary by CodeRabbit

  • New Features
    • Custom review prompts via --prompt-file, per-minute rate limiting, new ReadSkill renderer, and a merge-gate hook that blocks merges until external review status is confirmed.
  • Bug Fixes
    • Review validation can drop invalid evidence without failing runs; unattended auto-approval now fails closed for disallowed destructive actions; dispatch workflow degrades gracefully with retries and warnings.
  • Documentation
    • Clarified CLI/agent guidance and stateful review workflow docs.
  • Style
    • Theme-aligned activity colors, refined tool-header spacing, bordered-grid Markdown table rendering.
  • Tests
    • Added unit and E2E tests for review partitioning, approval behavior, UI rendering, and tokens.

elkaix added 5 commits June 2, 2026 13:07
A broken tap (lost HOMEBREW_TAP_TOKEN, org migration, etc.) was blocking
the promote-release polling loop indefinitely, preventing the GitHub
Release from ever reaching Latest and leaving install scripts pointing at
a stale prerelease.

Remove homebrew_ready from the hard polling condition. Hard gates are now
only required platform assets + PyPI — the channels that actually serve
the install scripts and in-app updater.

Add a best-effort 'Check Homebrew tap' step that runs after promotion:
it checks once and emits a warning annotation + step summary note + Slack
alert if the tap lags, then exits 0. The job still succeeds; the warning
is visible in the run summary without holding the release hostage.
Blocks gh pr create when shipped-code paths are changed but
## Unreleased in CHANGELOG.md is empty — catches the same gate
that changelog-entry-required CI enforces, before the push.

Escape hatches (mirroring CI): release/* branch, chore(release)
title, or [skip changelog] in the PR body.

Also unblocks .claude/settings.json and .claude/hooks/ from
.gitignore (changed .claude to .claude/* so negation patterns work)
so project-scoped hook config is tracked by the team.
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f1018a3f-f322-4a98-8464-39a2681dbd9a

📥 Commits

Reviewing files that changed from the base of the PR and between 0830a35 and 80ceaa0.

📒 Files selected for processing (2)
  • tests/test_release_update_pipeline.py
  • tests/ui/test_shell_markdown.py

📝 Walkthrough

Walkthrough

Adds a CodeRabbit pre-merge gate and a resilient release dispatch; refactors review prompts into manifest-backed bundles with manifest-aware validation and rate-limiting; centralizes security review knowledge; introduces destructive-action deliberation and unattended-denial behavior; refreshes TUI/theme, tool headers, markdown table rendering, and tests.

Changes

Merge Gate and Release Workflows

Layer / File(s) Summary
CodeRabbit merge-gate hook
.claude/hooks/coderabbit-merge-gate.sh
Adds PreToolUse hook that resolves PR head commit, queries CodeRabbit status and actionable-comment counts, and blocks/annotates merges based on review state.
Best-effort release sync workflow
.github/workflows/dispatch-pythinker-home-sync.yml
Uses pinned actions/create-github-app-token, runs mint step with continue-on-error, adds degrade/warning behavior, retries repository_dispatch with backoff, and degrades gracefully instead of failing main branch.

Reviewflow Validation and Manifests

Layer / File(s) Summary
Shared security knowledge & scan ordering
packages/pythinker-review/src/pythinker_review/security_scan/knowledge.py, packages/pythinker-review/src/pythinker_review/security_scan/prompt.py, packages/pythinker-review/src/pythinker_review/signals/advisor.py, packages/pythinker-review/src/pythinker_review/security_scan/processor.py, packages/pythinker-review/src/pythinker_review/security_scan/tech.py
Centralizes TECH_HIGHLIGHTS/SLUG_NOTES, ports prompt consumers, adds YAML detection and priority-aware file ordering.
Prompt manifest contracts and assembly
packages/pythinker-review/src/pythinker_review/reviewflow/provider.py
Adds frozen dataclasses for prompt files/manifests/bundles, REVIEW_PROMPT_FILE_CHAR_LIMIT, and build_feature_review_prompt_bundle() that emits line-numbered excerpts, prompt-context JSON, and accepts custom_prompt.
Evidence validation, partitioning, and rate limiting
packages/pythinker-review/src/pythinker_review/reviewflow/workflow.py
Introduces review_feature_partitioned use, an async rate limiter, manifest-aware evidence validation that can record non-fatal drops, and records manifest/drop metadata when marking features reviewed.
CLI options, docs, and tests
packages/pythinker-review/src/pythinker_review/cli/review.py, packages/pythinker-review/README.md, packages/pythinker-review/docs/blackbox-parity.md, packages/pythinker-review/tests/unit/test_reviewflow.py, packages/pythinker-review/tests/e2e/test_reviewflow_workflow.py
Adds --prompt-file and --rate-limit-per-minute options, updates docs for line-numbered manifests and drop semantics, and adds unit/e2e tests for prompt bundle assembly and drop-handling without run failure.

Approval and Auto Mode

Layer / File(s) Summary
Config, contracts, and settings UI
src/pythinker_code/config.py, src/pythinker_code/cli/__init__.py, src/pythinker_code/ui/shell/selectors/settings.py
Adds auto_deliberate_destructive_actions to Config (autonomous default), updates CLI help text for --auto/--print, and exposes the setting in the interactive settings UI.
Approval result and unattended denials
src/pythinker_code/soul/approval.py, src/pythinker_code/soul/agent.py
Extends ApprovalResult with user_rejection, adds unattended-denial feedback helper, and early-return behavior with telemetry for auto-unavailable cases.
Auto-mode injection variants & tests
src/pythinker_code/soul/dynamic_injections/auto_mode.py, tests/core/test_auto_injection.py, tests/core/test_approval_auto.py, tests/core/test_runtime_auto_state.py, tests/core/test_config.py
Selects among standard/deliberate/destructive-deliberate auto-mode prompts based on policy/config and expands tests for safe-mode fail-closed, outside-workspace gating, runtime injection, and destructive-deliberation gating.

Shell UI Theme and Rendering

Layer / File(s) Summary
Activity tokens and prompt framing
src/pythinker_code/ui/theme.py, src/pythinker_code/ui/shell/prompt.py
Adds activity token fields to TuiTokens, unifies thinking-frame scale aliases, and makes prompt-separator styling capability-aware.
Motion and live rendering
src/pythinker_code/ui/shell/motion.py, src/pythinker_code/ui/shell/visualize/_live_view.py, src/pythinker_code/ui/shell/visualize/_worklog.py, src/pythinker_code/ui/shell/tool_renderers/todo.py
Moves shimmer/spinner palettes to theme tokens, refactors shimmer generators to accept theme palettes, updates todo/worklog/live-view rendering for activity styling, and adds shimmer-label control.
Tool headers and ReadSkill renderer
src/pythinker_code/ui/shell/tool_renderers/_render_utils.py, src/pythinker_code/ui/shell/tool_renderers/agent.py, src/pythinker_code/ui/shell/tool_renderers/skill.py, src/pythinker_code/tools/__init__.py, src/pythinker_code/ui/shell/tool_renderers/__init__.py
Changes tool header formatting to "Tool summary" (space-separated), adds ReadSkill key-arg extraction and a new ReadSkill renderer, registers renderer and updates worklog/tool-style mapping.
Recap and Markdown table rendering
src/pythinker_code/session_recap.py, src/pythinker_code/ui/shell/slash.py, src/pythinker_code/ui/shell/echo.py, src/pythinker_code/utils/rich/markdown.py, tests
Enhances recap source cleanup (strip fenced blocks/tables/ATX headings), prioritizes action/status outcomes, renders recaps and changelog as Markdown, replaces record-style table fallback with a bordered-grid table renderer and per-cell justification, and updates tests and /config hint text.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-mode-tui-rendering

elkaix added 2 commits June 2, 2026 14:16
Two suites drifted from intentional changes already on this branch:

- dispatch-pythinker-home-sync.yml was redesigned to degrade gracefully
  (best-effort sync backstopped by pythinker-home's daily cron) instead of
  failing loud. Update the site-dispatch test to the new contract: still
  require no PAT, App-based auth, a single-repo + contents-only scoped token,
  a SHA-pinned create-github-app-token action, and a read-only job
  GITHUB_TOKEN, but assert the dispatch degrades (continue-on-error, no
  exit 1) while still surfacing failures via a step-summary warning and Slack
  alert. Rename to ..._degrades_gracefully.

- The Agent tool description gained two orchestration bullets (durable
  finding IDs; stateful review loop). Regenerate the two stale inline
  snapshots so they match the shipped description.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/core/test_runtime_auto_state.py`:
- Around line 99-132: The test function
test_unattended_runtime_in_default_safe_mode_denies_without_waiting has the
pytest.mark.asyncio decorator applied twice; remove the duplicate decorator so
the function is annotated only once (keep a single `@pytest.mark.asyncio` above
the function definition) to avoid redundant decoration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: db23cf76-7947-4839-94bc-4dc95f5a58b5

📥 Commits

Reviewing files that changed from the base of the PR and between 139adc5 and d291d53.

📒 Files selected for processing (65)
  • .claude/hooks/coderabbit-merge-gate.sh
  • .github/workflows/dispatch-pythinker-home-sync.yml
  • packages/pythinker-review/README.md
  • packages/pythinker-review/docs/blackbox-parity.md
  • packages/pythinker-review/src/pythinker_review/cli/review.py
  • packages/pythinker-review/src/pythinker_review/reviewflow/provider.py
  • packages/pythinker-review/src/pythinker_review/reviewflow/workflow.py
  • packages/pythinker-review/src/pythinker_review/security_scan/knowledge.py
  • packages/pythinker-review/src/pythinker_review/security_scan/processor.py
  • packages/pythinker-review/src/pythinker_review/security_scan/prompt.py
  • packages/pythinker-review/src/pythinker_review/security_scan/tech.py
  • packages/pythinker-review/src/pythinker_review/signals/advisor.py
  • packages/pythinker-review/tests/e2e/test_reviewflow_workflow.py
  • packages/pythinker-review/tests/unit/test_reviewflow.py
  • packages/pythinker-review/tests/unit/test_security_scan.py
  • packages/pythinker-review/tests/unit/test_signals.py
  • src/pythinker_code/agents/default/code_reviewer.yaml
  • src/pythinker_code/agents/default/security_reviewer.yaml
  • src/pythinker_code/cli/__init__.py
  • src/pythinker_code/config.py
  • src/pythinker_code/session_recap.py
  • src/pythinker_code/soul/agent.py
  • src/pythinker_code/soul/approval.py
  • src/pythinker_code/soul/dynamic_injections/auto_mode.py
  • src/pythinker_code/tools/__init__.py
  • src/pythinker_code/tools/agent/description.md
  • src/pythinker_code/ui/shell/echo.py
  • src/pythinker_code/ui/shell/motion.py
  • src/pythinker_code/ui/shell/prompt.py
  • src/pythinker_code/ui/shell/selectors/settings.py
  • src/pythinker_code/ui/shell/slash.py
  • src/pythinker_code/ui/shell/tool_renderers/__init__.py
  • src/pythinker_code/ui/shell/tool_renderers/_render_utils.py
  • src/pythinker_code/ui/shell/tool_renderers/agent.py
  • src/pythinker_code/ui/shell/tool_renderers/skill.py
  • src/pythinker_code/ui/shell/tool_renderers/todo.py
  • src/pythinker_code/ui/shell/visualize/_live_view.py
  • src/pythinker_code/ui/shell/visualize/_worklog.py
  • src/pythinker_code/ui/theme.py
  • src/pythinker_code/utils/rich/markdown.py
  • tests/core/test_approval_auto.py
  • tests/core/test_auto_injection.py
  • tests/core/test_config.py
  • tests/core/test_runtime_auto_state.py
  • tests/e2e/test_shell_modal_e2e.py
  • tests/e2e/test_shell_pty_e2e.py
  • tests/test_session_recap.py
  • tests/ui/test_shell_markdown.py
  • tests/ui_and_conv/README_contract_registry.md
  • tests/ui_and_conv/test_live_view_notifications.py
  • tests/ui_and_conv/test_live_view_todos.py
  • tests/ui_and_conv/test_md_table_contract.py
  • tests/ui_and_conv/test_prompt_tips.py
  • tests/ui_and_conv/test_settings_selector.py
  • tests/ui_and_conv/test_shell_design_system.py
  • tests/ui_and_conv/test_shell_motion.py
  • tests/ui_and_conv/test_shell_motion_shimmer.py
  • tests/ui_and_conv/test_shell_prompt_echo.py
  • tests/ui_and_conv/test_shell_slash_commands.py
  • tests/ui_and_conv/test_thinking_cycle.py
  • tests/ui_and_conv/test_tui_blocks_integration.py
  • tests/ui_and_conv/test_tui_card_tool_renderers.py
  • tests/ui_and_conv/test_tui_theme_tokens.py
  • tests/ui_and_conv/test_visualize_running_prompt.py
  • tests/utils/test_rich_markdown.py

Comment thread tests/core/test_runtime_auto_state.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/core/test_default_agent.py (1)

550-637: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add focused assertions for the new prompt bullets instead of extending the monolithic snapshot.

These two new requirements are only covered by a huge prompt snapshot, which makes the test brittle and hard to review. Add small invariant checks for the new guidance text and keep the snapshot for broader regressions if you still want it.

As per coding guidelines, tests/**/*agent*.py: "When changing prompts/specs, update or add focused tests; avoid brittle tests that assert large prompt snapshots; prefer behavior, required sections, and exact small invariants".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/core/test_default_agent.py` around lines 550 - 637, Replace the giant
snapshot assertion on agent.toolset.tools[0].description with targeted invariant
checks for the two new prompt bullets: add small assertions that specific key
phrases exist in agent.toolset.tools[0].description (e.g., "Explore Agent —
Preferred for Codebase Research" and the short list items like "quick",
"medium", "thorough" or the "When Not To Use Agent" short guidance) and keep the
full snapshot assertion only as a separate broader-regression test if desired;
update tests in test_default_agent.py to assert these exact substrings rather
than relying solely on the monolithic snapshot.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_release_update_pipeline.py`:
- Around line 92-93: The two assertions are too global—narrow them to the
app-token/degradation step block in tests/test_release_update_pipeline.py so
unrelated steps don't affect the check; locate where the test builds the
workflow string (variable workflow) and instead of asserting across the whole
workflow, find the substring for the step named "app-token" or "degradation"
(e.g., match the step header "name: app-token" or "name: degradation" and
extract its block) and then assert "continue-on-error: true" is present and
"exit 1" is not present within that extracted block only.

---

Outside diff comments:
In `@tests/core/test_default_agent.py`:
- Around line 550-637: Replace the giant snapshot assertion on
agent.toolset.tools[0].description with targeted invariant checks for the two
new prompt bullets: add small assertions that specific key phrases exist in
agent.toolset.tools[0].description (e.g., "Explore Agent — Preferred for
Codebase Research" and the short list items like "quick", "medium", "thorough"
or the "When Not To Use Agent" short guidance) and keep the full snapshot
assertion only as a separate broader-regression test if desired; update tests in
test_default_agent.py to assert these exact substrings rather than relying
solely on the monolithic snapshot.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ff5d2494-16bf-4660-be06-299f79df9f55

📥 Commits

Reviewing files that changed from the base of the PR and between d291d53 and 4e11238.

📒 Files selected for processing (3)
  • tests/core/test_default_agent.py
  • tests/test_release_update_pipeline.py
  • tests/tools/test_tool_descriptions.py

Comment thread tests/test_release_update_pipeline.py Outdated
@elkaix elkaix changed the title Improve auto-mode TUI rendering and reviewflow validation feat: improve auto-mode TUI rendering and reviewflow validation Jun 2, 2026
elkaix added 2 commits June 2, 2026 14:45
- CHANGELOG.md: add `## Unreleased` entries for the TUI rendering,
  auto-mode approval, and reviewflow changes so the
  changelog-entry-required gate passes.
- test_shell_markdown: assert the wrapped "Suggested improvement" header
  fragment via "improvement"[:-1] instead of a misspelled string literal,
  so the typos spell-check passes while keeping the same coverage.
- test_runtime_auto_state: drop a duplicate @pytest.mark.asyncio decorator
  flagged by CodeRabbit.

The PR title was also updated to a Conventional Commit prefix.
Address CodeRabbit: the continue-on-error / no-exit-1 checks scanned the
whole workflow file, so an unrelated step could satisfy or break them. Add
a _step_block helper and assert continue-on-error on the token-mint step and
the absence of exit 1 (plus presence of exit 0) within the dispatch step.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_release_update_pipeline.py`:
- Around line 17-34: The helper _step_block currently lets next(...) raise
StopIteration with no context if name_fragment isn't found; change it to handle
that case by capturing the result (e.g., use next(..., None) or wrap in
try/except) and raise a clear assertion or ValueError that includes the missing
name_fragment (and optionally the workflow snippet) so test failures show which
step was missing; modify the logic around the start variable in _step_block to
check for None or catch StopIteration and raise the descriptive error before
continuing.

In `@tests/ui/test_shell_markdown.py`:
- Line 156: The compound assertion at the end of test_shell_markdown.py uses a
single `assert "Suggested" in output and "improvement"[:-1] in output`; split
this into two separate assertions so failures indicate which substring is
missing: one `assert "Suggested" in output` and another `assert
"improvement"[:-1] in output` (keep the existing slicing) located where the
original compound assert is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d2f27b10-4250-4652-ba35-51690cc008a4

📥 Commits

Reviewing files that changed from the base of the PR and between 4e11238 and 0830a35.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • tests/core/test_runtime_auto_state.py
  • tests/test_release_update_pipeline.py
  • tests/ui/test_shell_markdown.py
💤 Files with no reviewable changes (1)
  • tests/core/test_runtime_auto_state.py

Comment thread tests/test_release_update_pipeline.py
Comment thread tests/ui/test_shell_markdown.py Outdated
@elkaix
elkaix merged commit 15e3342 into main Jun 2, 2026
25 checks passed
@elkaix
elkaix deleted the feat/auto-mode-tui-rendering branch June 2, 2026 19:20
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