UAT: nox -e typecheck fails with 5 Pyright errors — session_service.py and cli/commands/session.py #1623

Open
opened 2026-04-02 23:17:00 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/session-pyright-errors
  • Commit Message: fix(session): resolve 5 Pyright type errors in session_service and session CLI
  • Milestone: v3.5.0
  • Parent Epic: #397

Description

The nox -e typecheck command (which runs Pyright) fails with 5 errors. The spec mandates that all code must pass nox -e typecheck and that all code must be statically typed. This is a blocking quality gate failure.

What was tested:
Running nox -e typecheck in the cloned repository.

Expected behavior (from spec):
All code must pass nox -e typecheck. The command must exit with code 0.

Actual behavior:
The command exits with code 1 and reports 5 errors:

/src/cleveragents/application/services/session_service.py:263:20 - error: Operator "+" not supported for types "Literal['sha256:']" and "Any | None"
  Operator "+" not supported for types "Literal['sha256:']" and "None" (reportOperatorIssue)
/src/cleveragents/application/services/session_service.py:268:33 - error: Operator "+" not supported for types "Literal['sha256:']" and "dict[str, Any]" (reportOperatorIssue)
/src/cleveragents/cli/commands/session.py:223:53 - error: Cannot access attribute "automation_profile" for class "Session"
  Attribute "automation_profile" is unknown (reportAttributeAccessIssue)
/src/cleveragents/cli/commands/session.py:383:49 - error: Cannot access attribute "automation_profile" for class "Session"
  Attribute "automation_profile" is unknown (reportAttributeAccessIssue)
/src/cleveragents/cli/commands/session.py:493:28 - error: Cannot access attribute "list_messages" for class "SessionService"
  Attribute "list_messages" is unknown (reportAttributeAccessIssue)

Root cause analysis:

  1. session_service.py lines 263 and 268: The code attempts to concatenate "sha256:" with data.get("checksum") (which returns Any | None) and with a dict expression. String concatenation with None or a dict is a type error. The logic also appears to be semantically wrong — "sha256:" + {k: v ...} would fail at runtime too.

  2. session.py lines 223 and 383: The Session domain model (src/cleveragents/domain/models/core/session.py) does not have an automation_profile attribute. The CLI command accesses session.automation_profile which does not exist on the Session class.

  3. session.py line 493: The SessionService abstract class does not define a list_messages method. The CLI command calls service.list_messages(session_id) but this method is not in the abstract interface.

Steps to reproduce:

git clone https://git.cleverthis.com/cleveragents/cleveragents-core.git
cd cleveragents-core
nox -e typecheck

Code locations:

  • src/cleveragents/application/services/session_service.py lines 263, 268
  • src/cleveragents/cli/commands/session.py lines 223, 383, 493
  • src/cleveragents/domain/models/core/session.py (Session class — missing automation_profile field)

Subtasks

  • Investigate session_service.py lines 263–268: fix the "sha256:" + string concatenation type errors — either cast data.get("checksum") to str with a proper null guard, or restructure the checksum logic to avoid concatenating incompatible types
  • Investigate session.py lines 223 and 383: determine whether automation_profile should be added to the Session domain model (per spec) or whether the CLI references are incorrect and must be removed/replaced
  • Investigate session.py line 493: determine whether list_messages should be added to the SessionService abstract interface or whether the CLI call is incorrect and must be removed/replaced
  • Implement all required fixes with full static typing (no # type: ignore suppressions permitted)
  • Tests (Behave): add/update unit test scenarios in features/ covering the fixed code paths
  • Tests (Robot): add/update integration test(s) in robot/ if the fix touches integration-level behaviour
  • Verify nox -e typecheck exits with code 0 and reports 0 errors
  • Verify coverage >= 97% via nox -e coverage_report
  • Run full nox (all default sessions) and confirm all stages pass

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • nox -e typecheck exits with code 0 and reports 0 Pyright errors.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (fix(session): resolve 5 Pyright type errors in session_service and session CLI), followed by a blank line, then additional lines providing relevant details about the implementation. The commit message body must end with ISSUES CLOSED: #<this issue number>.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (fix/session-pyright-errors).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/session-pyright-errors` - **Commit Message**: `fix(session): resolve 5 Pyright type errors in session_service and session CLI` - **Milestone**: v3.5.0 - **Parent Epic**: #397 ## Description The `nox -e typecheck` command (which runs Pyright) fails with 5 errors. The spec mandates that all code must pass `nox -e typecheck` and that all code must be statically typed. This is a blocking quality gate failure. **What was tested:** Running `nox -e typecheck` in the cloned repository. **Expected behavior (from spec):** All code must pass `nox -e typecheck`. The command must exit with code 0. **Actual behavior:** The command exits with code 1 and reports 5 errors: ``` /src/cleveragents/application/services/session_service.py:263:20 - error: Operator "+" not supported for types "Literal['sha256:']" and "Any | None" Operator "+" not supported for types "Literal['sha256:']" and "None" (reportOperatorIssue) /src/cleveragents/application/services/session_service.py:268:33 - error: Operator "+" not supported for types "Literal['sha256:']" and "dict[str, Any]" (reportOperatorIssue) /src/cleveragents/cli/commands/session.py:223:53 - error: Cannot access attribute "automation_profile" for class "Session" Attribute "automation_profile" is unknown (reportAttributeAccessIssue) /src/cleveragents/cli/commands/session.py:383:49 - error: Cannot access attribute "automation_profile" for class "Session" Attribute "automation_profile" is unknown (reportAttributeAccessIssue) /src/cleveragents/cli/commands/session.py:493:28 - error: Cannot access attribute "list_messages" for class "SessionService" Attribute "list_messages" is unknown (reportAttributeAccessIssue) ``` **Root cause analysis:** 1. **session_service.py lines 263 and 268**: The code attempts to concatenate `"sha256:"` with `data.get("checksum")` (which returns `Any | None`) and with a dict expression. String concatenation with `None` or a dict is a type error. The logic also appears to be semantically wrong — `"sha256:" + {k: v ...}` would fail at runtime too. 2. **session.py lines 223 and 383**: The `Session` domain model (`src/cleveragents/domain/models/core/session.py`) does not have an `automation_profile` attribute. The CLI command accesses `session.automation_profile` which does not exist on the `Session` class. 3. **session.py line 493**: The `SessionService` abstract class does not define a `list_messages` method. The CLI command calls `service.list_messages(session_id)` but this method is not in the abstract interface. **Steps to reproduce:** ```bash git clone https://git.cleverthis.com/cleveragents/cleveragents-core.git cd cleveragents-core nox -e typecheck ``` **Code locations:** - `src/cleveragents/application/services/session_service.py` lines 263, 268 - `src/cleveragents/cli/commands/session.py` lines 223, 383, 493 - `src/cleveragents/domain/models/core/session.py` (Session class — missing `automation_profile` field) ## Subtasks - [ ] Investigate `session_service.py` lines 263–268: fix the `"sha256:" +` string concatenation type errors — either cast `data.get("checksum")` to `str` with a proper null guard, or restructure the checksum logic to avoid concatenating incompatible types - [ ] Investigate `session.py` lines 223 and 383: determine whether `automation_profile` should be added to the `Session` domain model (per spec) or whether the CLI references are incorrect and must be removed/replaced - [ ] Investigate `session.py` line 493: determine whether `list_messages` should be added to the `SessionService` abstract interface or whether the CLI call is incorrect and must be removed/replaced - [ ] Implement all required fixes with full static typing (no `# type: ignore` suppressions permitted) - [ ] Tests (Behave): add/update unit test scenarios in `features/` covering the fixed code paths - [ ] Tests (Robot): add/update integration test(s) in `robot/` if the fix touches integration-level behaviour - [ ] Verify `nox -e typecheck` exits with code 0 and reports 0 errors - [ ] Verify coverage >= 97% via `nox -e coverage_report` - [ ] Run full `nox` (all default sessions) and confirm all stages pass ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `nox -e typecheck` exits with code 0 and reports 0 Pyright errors. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`fix(session): resolve 5 Pyright type errors in session_service and session CLI`), followed by a blank line, then additional lines providing relevant details about the implementation. The commit message body must end with `ISSUES CLOSED: #<this issue number>`. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`fix/session-pyright-errors`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.5.0 milestone 2026-04-02 23:17:18 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Priority/High (confirmed) — Pyright errors are a blocking quality gate failure
  • MoSCoW: MoSCoW/Must Have — nox -e typecheck is a mandatory CI quality gate. 5 Pyright errors mean the typecheck stage fails, which blocks all PR merges per CONTRIBUTING.md. This is a Must Have blocker that must be fixed before any other work can be merged.
  • Milestone: v3.5.0 (confirmed)
  • Parent Epic: #397

The 5 errors are well-documented with clear root causes. This should be a relatively quick fix compared to #1631.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Priority/High (confirmed) — Pyright errors are a blocking quality gate failure - **MoSCoW**: MoSCoW/Must Have — `nox -e typecheck` is a mandatory CI quality gate. 5 Pyright errors mean the typecheck stage fails, which blocks all PR merges per CONTRIBUTING.md. This is a Must Have blocker that must be fixed before any other work can be merged. - **Milestone**: v3.5.0 (confirmed) - **Parent Epic**: #397 The 5 errors are well-documented with clear root causes. This should be a relatively quick fix compared to #1631. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#1623
No description provided.