Skip to content

Drop reason from TechreadException - #598

Merged
jmtts merged 1 commit into
mainfrom
claude/infra-reader-api-optimization-9xfnph-drop-reason
Sep 30, 2026
Merged

jmtts merged 1 commit into
mainfrom
claude/infra-reader-api-optimization-9xfnph-drop-reason

Conversation

@werk24

@werk24 werk24 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

The owner decided on 2026-09-30 to drop reason completely (core-reader#2453). A READ_INCOMPLETE warning tells the customer that a read is incomplete, never why.

History of the field:

The change:

  • werk24/models/v2/internal.py: remove the field and its docstring lines. The READ_INCOMPLETE docstring now says the warning never says why. ask_type stays.
  • werk24/cli/commands/techread.py: stop printing , reason <x>. That line came in with Clearer first-run experience: size check, key handling, readable errors, JSON CLI, notebooks #591, after #2453 was written. Without this change, werk24 techread would crash on any message carrying an exception.
  • Tests:
    • The existing tests no longer use the field.
    • A new test pins that the model has no reason.
    • Another new test pins that a message still carrying "reason" parses, with the key ignored and never dumped. The model keeps pydantic's default of ignoring unknown keys.

Compatibility. Nothing changes on the wire, because the server never sent the field. It is a removal from a released public model, though. Code on 2.8.0 that reads exception.reason directly would get AttributeError after upgrading; getattr(exc, "reason", None) keeps working. The docs-v2 changelog PR announces it.

Merge order:

  1. core-reader#2511 first. core-reader installs werk24 from main unpinned, and two of its tests read the field.
  2. Then this PR.
  3. werkflow pins werk24 at 80db94a, so it is not affected until it bumps. Its own PR removes the field there.

Tests.

  • .venv/bin/python -m pytest -q -p no:cacheprovider (Python 3.13, from requirements.txt, tests/requirements.txt and -e .): 999 passed, 5 skipped. The 5 skipped are the credentialed live tests.
  • The two changed test files: 28 passed, against 26 on main. The difference is the 2 new tests.

Questions for the owner

One question. It does not block the merge.

  1. Release this as 2.8.1?
    • A removal from a public model would usually wait for a major version. But the field has been out for two days and has never carried a value, so a patch release removes it before anyone builds on it.
    • Without a release, PyPI users keep 2.8.0 with the empty field. core-reader and docs-v2 already track main.
    • Recommendation: yes, 2.8.1, with a release note pointing at the docs-v2 changelog entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H5VZH5w3jzcmxijpeamRaB


Generated by Claude Code

The owner decided that a READ_INCOMPLETE warning tells the customer that
a read is incomplete, never why (core-reader#2453). core-reader stopped
sending the field in core-reader#2452, and no production release ever
sent it. Remove it from the model, its docstrings and the techread CLI,
which printed it.

A message that still carries "reason" parses as before: the model keeps
pydantic's default of ignoring unknown keys, and a test pins that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H5VZH5w3jzcmxijpeamRaB
Copilot AI balanced review requested due to automatic review settings September 30, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused removal is consistently applied, preserves legacy wire compatibility, and has appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Removes the unused reason field from TechreadException while preserving compatibility with legacy payloads.

Changes:

  • Removes the model field and CLI rendering.
  • Updates documentation and tests.
  • Confirms legacy reason keys are ignored during parsing.
File Description
werk24/​models/​v2/​internal.py Removes reason from the model and documentation.
werk24/​cli/​commands/​techread.py Stops displaying the removed field.
tests/​test_read_incomplete_warning.py Tests field removal and legacy payload handling.
tests/​test_cli_techread_command.py Updates expected CLI exception output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jmtts
jmtts merged commit ee5a2ec into main Sep 30, 2026
8 checks passed
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.

4 participants