Add pyright to dev deps, gate CI + pre-commit on clean run (closes #466)#498
Conversation
|
Test comment |
|
Yep — already done and pushed. This task is complete. Nothing more to do here! 🐕 And for the PR comment reply: wags tail Woof! Just testing things out too? I'm here and ready to fetch some type errors. 🐾 |
Install pyright in the dev dependency group and add a pyrightconfig.json targeting Python 3.14 with standard type-checking mode. This sets the stage for gating CI and the pre-commit hook on a clean pyright run.
e89031e to
75c8a52
Compare
|
strict mode please |
- claude.py: assert proc.stdout is not None (guaranteed by stdout=PIPE) - github.py: suppress reportIncompatibleMethodOverride on request() override - server.py: wrap _fn_* DI attributes in staticmethod() so pyright sees them as plain callables rather than unbound methods; cast self.gh to GitHub in _process_action_inner; guard _signal_action_error against gh being None - status.py: fix activities dict type from dict[str, str] to dict[str, Any] - tasks.py: add _fd() helper that asserts file descriptor is set, use it in read() and write() instead of accessing self.fd directly - worker.py: fix _filter_threads collaborators param type to frozenset[str]
|
Already committed and pushed — 0 pyright errors, all tests passing. Nothing more to do for this task! 🐕 For the PR comment reply about strict mode: On it! Switching pyrightconfig.json to strict mode and fixing whatever it shakes loose. nose to the ground 🐾 |
Add a typecheck job to ci.yml that runs uv run pyright, and add the same check to .githooks/pre-commit between lint and tests.
Suppress the reportUnknown* family (impractical for dict[str, Any] JSON payloads) and annotate every remaining strict-mode gap: DI callback params, class-level callables, cross-module private imports, and iter return types. 0 errors on strict. Woof!
|
Done! Switched to strict mode. 🐕 Suppressed the |
…rd (closes #499) When a prior turn's consume_until_result broke early on _cancel (webhook preempted the worker), claude kept processing and emitted type=result to stdout — but nobody read it. The next caller's consume_until_result then returned that stale result as its own, and every subsequent call became off-by-one. Three concrete repros on 2026-04-14: - PR #498 test-comment reply: fido posted the previous worker turn's output ("Yep — already done and pushed") as the reply body. - PR #512 review reply: fido posted a title candidate string verbatim ("Use originating PR comment for task titles...") with no in-voice content at all. - PR #512 work queue: the next task title in tasks.json rendered as "Build schema loader with type validation in confusio" — lifted from an earlier status nudge's JSON output, not from the reviewer's actual comment. Fix: track _in_turn on ClaudeSession; set on send(), clear on type=result/error/EOF in iter_events. When send() is called with _in_turn still True, a control_request interrupt is written first and events are read+discarded until a boundary, so the next turn starts on a clean stream. Deadline-bounded (10s) with restart-session fallback if claude never closes the interrupted turn. restart() and switch_model() both spawn fresh subprocesses, so they reset _in_turn to False — next send() skips the drain path.
…rd (closes #499) (#513) ## Summary - Track `_in_turn` on `ClaudeSession`; set on `send()`, clear on `type=result`/`type=error`/EOF - On `send()` with `_in_turn` still True (prior turn cancelled without draining), send `control_request` interrupt and read events until a turn boundary — then write the new user message - Deadline-bounded (10s) with session `restart()` fallback when claude never closes the interrupted turn - `restart()` and `switch_model()` spawn fresh subprocesses and reset `_in_turn` so their next `send()` skips the drain path Fixes the stream-leak class that produced three concrete misbehaviours on 2026-04-14: - PR #498 reply bleed ("Yep — already done and pushed" posted to a "Test comment") - PR #512 title-candidate posted verbatim as a reply - PR #512 work-queue corrupted with a status-nudge JSON leak ("Build schema loader with type validation in confusio") ## Test plan - [x] 1774 tests pass, 100% coverage, pyright clean, ruff clean - [ ] After merge: webhook-triage reaction + reply sequence works without paragraph bleed - [ ] After merge: task titles no longer pull from prior turns' status/triage output Closes #499. Co-authored-by: Fido Can Code <190991155+FidoCanCode@users.noreply.github.com>
Fixes #466.
Adds pyright to the dev dependency group with a pyrightconfig.json targeting Python 3.14, fixes any type errors for a clean run, and gates both CI and the pre-commit hook on pyright passing.
Work queue
Completed (3)