Skip to content

[TASK] Refactor isInputBlocked to drop unreachable view checks and stale ponytail markers #1921

Closed

Description

Summary

ChatApplication.isInputBlocked in internal/presentation/tui/app/chat.go returns currentView != tui.ViewStateChat || ... || currentView == tui.ViewStateDiffViewer || currentView == tui.ViewStateExplorer || currentView == tui.ViewStateHelp. The last three operands can never change the result, because each of those views already makes the first operand currentView != tui.ViewStateChat true. All four operands came in one commit, so the trailing ones read like extra rules when they are dead. Principle: clean-code "dead code and unreachable branches" (delete them).

The marker above it, // ponytail: extracted to reduce cyclomatic complexity of handleViewSpecificMessages, is a deferred-shortcut marker with no limit and no upgrade trigger, and the code has outgrown it. isInputBlocked is now a shared predicate called from handleViewSpecificMessages (twice), from CanRequestSuggestion and from chat_workspaces_test.go, not a helper split off one function. The same kind of non-deferral marker sits on inspectPluginHooks in internal/plugins/installer.go (// ponytail: extracted to reduce nestif complexity in Inspect. followed by ceiling: none). Neither marker records a shortcut, yet the shortcut ledger counts both as debt with no trigger. Principle: clean-code "comments that no longer match the code", and the ledger rule that a marker names a limit and an upgrade trigger.

Acceptance Criteria

  • Before: isInputBlocked ends with || currentView == tui.ViewStateDiffViewer || currentView == tui.ViewStateExplorer || currentView == tui.ViewStateHelp. After: those three operands are removed and currentView != tui.ViewStateChat alone covers every non-chat view.
  • Before: isInputBlocked carries // ponytail: extracted to reduce cyclomatic complexity of handleViewSpecificMessages. After: the marker is removed and replaced by a short doc comment that says what blocks input (a non-chat view, a pending approval, plan approval or user question, a retry, a teleport, or message-history mode).
  • Before: inspectPluginHooks carries the three-line ponytail: / ceiling: none / upgrade: marker. After: the marker is removed and replaced by a one-line doc comment that says what the function returns.
  • Existing tests still pass.

Activity

  1. edenreich commented on Nov 20, 2026

    @edenreich
    Contributor

    @infer can you work on this? use /ponytail:ponytail /domain-driven-design /go /go-concurrency

  2. inference-gateway-maintainer commented on Nov 20, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Model: ollama_cloud/glm-5.3-flash · Action: v0.59.11 · CLI: v0.263.0 · Gateway: v0.68.0 · View Job

    Todos

    Pull Request

    #1922

    ✅ Infer Result: Success

    Done. Refactor complete and pushed - PR #1922 (ready for review, Resolves #1921).

    What changed (commit faa0094a, one commit, +5/-8):

    • internal/presentation/tui/app/chat.go: dropped the three unreachable operands from isInputBlocked's tail (== tui.ViewStateDiffViewer, == tui.ViewStateExplorer, == tui.ViewStateHelp) - currentView != tui.ViewStateChat alone covers every non-chat view. Replaced the stale // ponytail: extracted to reduce cyclomatic complexity of handleViewSpecificMessages marker with a doc comment listing what actually blocks input (non-chat view, pending approval, plan approval or user question, retry, teleport, message-history mode) - the predicate is now a shared gate used by handleViewSpecificMessages, CanRequestSuggestion and chat_workspaces_test.go, not an extraction of one function.
    • internal/plugins/installer.go: removed the three-line ponytail: / ceiling: none / upgrade: marker on inspectPluginHooks and stated in one line what it returns (whether hooks exist, the parsed hook commands, a validation error for an invalid hooks.yaml).

    All acceptance criteria met; behavior is provably unchanged, so no tests needed edits. Verified with go test ./internal/presentation/tui/app ./internal/plugins and task precommit:run (mod tidy, mocks, fmt, import-alias lint, golangci-lint, markdownlint) - all green. Issue also tracked on the Roadmap 2026 board (Status: QA until the PR merges).

    Skipped: a marker-scan ledger update (none exists in-repo; the ponytail notes are inline comments only) and a docs ticket (internal-only refactor, stated in the PR body). Risk: none beyond comment-only drift - the deleted operands were logically dead for every input.

    Model: ollama_cloud/glm-5.3-flash · Action: v0.59.11 · CLI: v0.263.0 · Gateway: v0.68.0 · Exit Code: 0 · Duration: 4m 58s

    Tokens: 1,342,383 in · 12,063 out · 1,354,446 total (25 requests)

    Tool calls: 40 total · 100% success rate

    Traces
    Session: 1795186279-d7124c8f
    
    session (headless, success)                                                                        4m50s
    ├── chat ollama_cloud/glm-5.3-flash                                                                26.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      25.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    25.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                       25.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                25.3s
    ├── execute_tool TodoWrite call_ndhqlicb                                                            55µs
    ├── execute_tool Skill call_f5jctlp0                                                                91µs
    ├── execute_tool Skill call_1xno13oy                                                               183µs
    ├── execute_tool Skill call_wyia0g56                                                                70µs
    ├── execute_tool Skill call_85ofoee0                                                                26µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 4.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.2s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        4.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.2s
    ├── execute_tool Bash call_vwndntdx                                                                350ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.0s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.0s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.0s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.0s
    ├── execute_tool Bash call_mqxnv33g                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.4s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.4s
    ├── execute_tool Bash call_94idanay                                                                 1.8s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.4s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.4s
    ├── execute_tool TodoWrite call_89qoxwbe                                                            54µs
    ├── execute_tool Bash call_gdnmwomf                                                                396ms
    ├── execute_tool Grep call_tuskf1kc                                                                  5ms
    ├── execute_tool Grep call_f5w2ytii                                                                  1ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.5s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.5s
    ├── execute_tool Bash call_8a7cyb5x                                                                 1.6s
    ├── execute_tool Read call_r6sqzbja                                                                276µs
    ├── execute_tool Read call_psrvldo8                                                                327µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                16.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      16.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    16.4s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                       16.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                16.4s
    ├── execute_tool Bash call_2z4qlzpj                                                                 1.4s
    ├── execute_tool Grep call_1xvrqmih                                                                690ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 7.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.5s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        7.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.5s
    ├── execute_tool MultiEdit call_z0ktcslw                                                           873µs
    ├── execute_tool Edit call_qgan9c42                                                                471µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.2s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.2s
    ├── execute_tool Grep call_6n4fa372                                                                800µs
    ├── execute_tool Bash call_q6v8bzw9                                                                 10ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.9s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.8s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.8s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.8s
    ├── execute_tool Read call_hvxlvpir                                                                302µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.1s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.1s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.1s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.1s
    ├── execute_tool TodoWrite call_y9rj84zi                                                            54µs
    ├── execute_tool Bash call_5mc0obi8                                                                  2ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
    ├── execute_tool Wait call_dwquywuj                                                                 1m9s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
    ├── execute_tool Bash call_xyamo0lc                                                                  2ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
    ├── execute_tool Wait call_b832tb41                                                                1m17s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 5.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.5s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        5.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.5s
    ├── execute_tool Bash call_k5b3z1vk                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
    ├── execute_tool Bash call_ylt8640q                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.5s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.5s
    ├── execute_tool Bash call_k16btw60                                                                23.8s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.3s
    ├── execute_tool Bash call_9l9vt65m                                                                 2.0s
    ├── execute_tool Write call_2xsz475e                                                               820µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.1s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.1s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.1s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.1s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.1s
    ├── execute_tool Bash call_a7uldl3j                                                                 1.9s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.2s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.2s
    ├── execute_tool TodoWrite call_c1ggnkf5                                                            51µs
    ├── execute_tool Bash call_4uqlmjex                                                                 1.1s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.5s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.5s
    ├── execute_tool Bash call_bugsur6w                                                                  6ms
    ├── execute_tool Bash call_bpq23dv8                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
    ├── execute_tool Bash call_bbzles4n                                                                955ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 1.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
    ├── execute_tool Bash call_4936mpkw                                                                 1.2s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 2.0s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.0s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.0s
    │           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.0s
    ├── execute_tool TodoWrite call_mnz0haz0                                                            61µs
    ╰── chat ollama_cloud/glm-5.3-flash                                                                 2.3s
        ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.3s
            ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
                ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.3s
                    ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
    
    Stats
    Tool Calls
    
    ╭───────────┬───────┬───────┬─────────╮
    │ Tool      │ Calls │ Fail% │ Avg     │
    ├───────────┼───────┼───────┼─────────┤
    │ Bash      │ 19    │ 0%    │ 1920ms  │
    │ TodoWrite │ 5     │ 0%    │ 53µs    │
    │ Skill     │ 4     │ 0%    │ 63µs    │
    │ Grep      │ 4     │ 0%    │ 174ms   │
    │ Read      │ 3     │ 0%    │ 298µs   │
    │ Wait      │ 2     │ 0%    │ 73001ms │
    │ Write     │ 1     │ 0%    │ 821µs   │
    │ MultiEdit │ 1     │ 0%    │ 846µs   │
    │ Edit      │ 1     │ 0%    │ 469µs   │
    ╰───────────┴───────┴───────┴─────────╯
    
    Token Usage
    
    ╭────────────────────────────┬─────────┬────────┬────────────┬─────────┬──────╮
    │ Model                      │ Prompt  │ Cached │ Completion │ Total   │ Cost │
    ├────────────────────────────┼─────────┼────────┼────────────┼─────────┼──────┤
    │ ollama_cloud/glm-5.3-flash │ 1342383 │ 976640 │ 12063      │ 1354446 │ -    │
    ╰────────────────────────────┴─────────┴────────┴────────────┴─────────┴──────╯
    
    Sessions
    
    ╭───────────┬──────────┬──────────╮
    │ Execution │ Mode     │ Sessions │
    ├───────────┼──────────┼──────────┤
    │ headless  │ headless │ 1        │
    ╰───────────┴──────────┴──────────╯
    

    Triggered by edenreich · Infer Action · OSS

  3. moved this from Todo to In progress in 2026on Nov 20, 2026
  4. moved this from In progress to QA in 2026on Nov 20, 2026
  5. inference-gateway-releaser commented on Nov 20, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.265.4 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  6. moved this from QA to Done in 2026on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorreleased

    Type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions