Skip to content

fix(app): process first CLI TUI input#280

Open
konard wants to merge 3 commits into
ProverCoderAI:mainfrom
konard:issue-274-1f6a9d48fe85
Open

fix(app): process first CLI TUI input#280
konard wants to merge 3 commits into
ProverCoderAI:mainfrom
konard:issue-274-1f6a9d48fe85

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented May 12, 2026

Summary

Fixes #274: the CLI TUI could appear ready while the first real user inputs were still ignored.

Root cause

A fresh menu snapshot started with inputStage: "cold" and skipInputs: 2. After the readiness/time gate had already finished, the Gridland input boundary could still consume two valid user key events, and the pure menu input handler also intentionally dropped the first single-character alias, arrow, or Enter event while moving from cold to active.

That violates the TUI liveness invariant: once the rendered menu is ready and not busy, a valid user key should be processed without requiring dummy keypresses.

Fix

  • Fresh CLI TUI snapshots now start with inputStage: "active" and skipInputs: 0.
  • The cold-stage input handler no longer drops semantic menu inputs; it activates and processes the first valid key in the same transition.
  • Existing post-interactive SSH/session handoff protection remains intact via restoreMenuAfterInteractiveEffect(... skipInputs: 2).
  • Removed the placeholder .gitkeep that was only used to bootstrap this PR branch.

Mathematical guarantees

  • Invariant: forall key in ValidMenuInput: ready(menu) and not busy(menu) and not sshActive(menu) -> processed(key).
  • CORE/SHELL boundary: bootstrap noise filtering remains in the Gridland shell gate (ready / ignoreUntil), while the pure input routing layer no longer discards valid domain events.
  • SOURCE: n/a.

Tests

  • bunx vitest run packages/app/tests/docker-git/menu-input-handler.test.ts
  • bun run --cwd packages/app lint:tests
  • bun run --cwd packages/app lint
  • bun run --cwd packages/app lint:effect
  • bun run --cwd packages/app typecheck
  • bun run check

Environment note: bun run --cwd packages/app test and full direct bunx vitest run were attempted locally, but this runner terminated them with SIGTERM before a Vitest assertion failure was emitted. The focused regression test and static/type checks above passed; CI should run the complete matrix on the pushed SHA.

konard added 2 commits May 12, 2026 09:49
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#274
@konard konard changed the title [WIP] Почему-то CLI TUI не работает fix(app): process first CLI TUI input May 12, 2026
@konard konard marked this pull request as ready for review May 12, 2026 10:22
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

Working session summary

Implemented and finalized PR #280: #280

Fixed the CLI TUI first-input bug by removing the cold-start swallow behavior and making fresh menu snapshots start with active input handling. Updated regression coverage in menu-input-handler.test.ts, with the implementation change in menu-input-handler.ts and menu-state.ts.

Verification:

  • Local targeted regression test passed.
  • Local lint, Effect lint, typecheck, and bun run check passed.
  • GitHub Actions for SHA 8090c62c62d62b1dd61aca06d2fecca146aefdc7 all passed: Check, Checking Dependencies, Snapshot.
  • PR is marked ready for review, merge state is CLEAN.
  • Working tree is clean.

SOURCE: n/a


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $20.312756

📊 Context and tokens usage:

  • 272.7K / 1.1M (26%) input tokens, 29.9K / 128K (23%) output tokens

Total: (272.7K + 16.2M cached) input tokens, 29.9K output tokens, $20.312756 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (44390KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Copy Markdown
Member

тут проблема была в том что он не загружал проекты хотя через browser версию всё работало

@skulidropek
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d4f148e-4c64-4639-9f24-f9aaee643988

📥 Commits

Reviewing files that changed from the base of the PR and between 8090c62 and 9e9d99b.

📒 Files selected for processing (1)
  • packages/app/src/docker-git/menu-state.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/app/src/docker-git/menu-state.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Menu input now activates reliably and processes the first key/arrow/return consistently on startup (no longer skips initial input).
  • Tests
    • Updated tests to reflect the menu initializing in an active state and to expect the first input to be processed immediately.

Walkthrough

Menu initialization now starts in the "active" input stage with skipInputs: 0. The input handler's activation logic was simplified to allow processing for any menu input or action key. Tests were updated to reflect these behaviors and to assert the new default snapshot.

Changes

Menu input flow

Layer / File(s) Summary
Menu state initialization contract
packages/app/src/docker-git/menu-state.ts
defaultMenuSnapshot() now initializes in "active" input stage with skipInputs: 0 (changed from "cold" with skipInputs: 2), with an issue-tracking comment documenting that the initial user key should be processed after readiness gates (issue-274).
Input activation simplification
packages/app/src/docker-git/menu-input-handler.ts
activateInput() logic was unified: it now returns { activated: true, allowProcessing: true } whenever menu input or action keys are present, removing prior conditional branches that withheld allowProcessing for certain inputs.
Test verification
packages/app/tests/docker-git/menu-input-handler.test.ts
Tests updated to expect runnerRunEffect and setSkipInputsMock invocation on cold-start input, and a new test verifies defaultMenuSnapshot() produces an "active" snapshot with skipInputs: 0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from cold to active ground,

First key pressed, the gates unbound,
No skips to stall the menu's song,
Inputs now flow and run along,
A merry hop, the TUI's sound.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(app): process first CLI TUI input' clearly and concisely summarizes the main change: enabling proper processing of the first user input in the CLI TUI.
Description check ✅ Passed The PR description covers root cause analysis, the fix implementation, mathematical guarantees, test verification, and environment notes—exceeding the template requirements with comprehensive detail.
Linked Issues check ✅ Passed The code changes directly address issue #274 by fixing the CLI TUI input processing bug: cold-start input is no longer dropped, and fresh snapshots initialize with active input handling [#274].
Out of Scope Changes check ✅ Passed All changes are within scope: modifications to menu input handler, menu state initialization, and related tests address the core issue; only mentioned out-of-scope change is removal of a placeholder .gitkeep file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/app/src/docker-git/menu-state.ts (1)

35-44: ⚡ Quick win

Normalize the traceability marker to QUOTE(ТЗ) (or n/a).

The new block uses QUOTE(ISSUE); the repo format requires QUOTE(ТЗ) for consistency.

Suggested patch
-// QUOTE(ISSUE): "Почему-то CLI TUI не работает"
+// QUOTE(ТЗ): "Почему-то CLI TUI не работает"

As per coding guidelines: “Functional comments must include: CHANGE, WHY, QUOTE(ТЗ) or n/a, REF, SOURCE or n/a, FORMAT THEOREM, PURITY (CORE|SHELL), EFFECT signature for SHELL functions, INVARIANT, and COMPLEXITY.”

🤖 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 `@packages/app/src/docker-git/menu-state.ts` around lines 35 - 44, Replace the
traceability marker "QUOTE(ISSUE)" in the top comment block with the
repo-standard "QUOTE(ТЗ)" (or "n/a") so the block that starts with
CHANGE/WHY/QUOTE/... conforms to the required metadata format; locate the
comment containing "QUOTE(ISSUE)" in menu-state.ts and update only that token to
"QUOTE(ТЗ)" (or "n/a") ensuring all other tags (CHANGE, WHY, REF, SOURCE, FORMAT
THEOREM, PURITY, EFFECT, INVARIANT, COMPLEXITY) remain unchanged.
🤖 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.

Nitpick comments:
In `@packages/app/src/docker-git/menu-state.ts`:
- Around line 35-44: Replace the traceability marker "QUOTE(ISSUE)" in the top
comment block with the repo-standard "QUOTE(ТЗ)" (or "n/a") so the block that
starts with CHANGE/WHY/QUOTE/... conforms to the required metadata format;
locate the comment containing "QUOTE(ISSUE)" in menu-state.ts and update only
that token to "QUOTE(ТЗ)" (or "n/a") ensuring all other tags (CHANGE, WHY, REF,
SOURCE, FORMAT THEOREM, PURITY, EFFECT, INVARIANT, COMPLEXITY) remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dee33db-6bd9-4220-a98b-982979ff7932

📥 Commits

Reviewing files that changed from the base of the PR and between 65c4f84 and 8090c62.

📒 Files selected for processing (3)
  • packages/app/src/docker-git/menu-input-handler.ts
  • packages/app/src/docker-git/menu-state.ts
  • packages/app/tests/docker-git/menu-input-handler.test.ts

Copy link
Copy Markdown

Fixed the CodeRabbit traceability nitpick in 9e9d99b: normalized QUOTE(ISSUE) to QUOTE(ТЗ) in packages/app/src/docker-git/menu-state.ts without changing runtime behavior.

Local verification:

  • bun run --cwd packages/app test tests/docker-git/menu-input-handler.test.ts passed
  • bun run --cwd packages/app typecheck passed

Note: full packages/app lint on this older branch still reports pre-existing duplicate-code findings unrelated to this one-line comment change.

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.

Почему-то CLI TUI не работает

3 participants