Skip to content

/task handler re-encodes valid task kinds as a tuple with a type: ignore instead of TaskManager validating TaskKind #33

Closed

Description

@CryptoJones

Location: src/perplexity_agent/tui/app.py:296, 305

The /task handler spells the valid kinds as the literal tuple ("search", "fetch") and silences the resulting mismatch with # type: ignore[arg-type], while TaskManager.add does no validation of its TaskKind.

Cost: the kind set is independently spelled in tasks.py's TaskKind Literal, _probe's branch, the app tuple, the usage string, and _HELP — adding a third kind (e.g. research) requires synchronized edits in 5 places, and the type: ignore hides any drift until a confusing runtime usage error.

Suggested fix: have TaskManager.add validate against a single source of truth (e.g. typing.get_args(TaskKind)) and derive the TUI's tuple/usage text from it; drop the ignore.

Found by /code-review (high effort).

Activity

  1. CryptoJones commented on Jun 15, 2026

    @CryptoJones
    OwnerAuthor

    Fixed: _cmd_task derives valid kinds from get_args(TaskKind) and uses cast, dropping the literal tuple + type: ignore (tui/app.py:324,335).

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions