Skip to content

Handle unknown disposition render values#163

Merged
wwind123 merged 1 commit into
mainfrom
codex/fix-issue-142-disposition-fallback
May 25, 2026
Merged

Handle unknown disposition render values#163
wwind123 merged 1 commit into
mainfrom
codex/fix-issue-142-disposition-fallback

Conversation

@wwind123
Copy link
Copy Markdown
Owner

Summary

  • add a defensive fallback when rendering prior item dispositions so new normalized values do not raise KeyError
  • add regression coverage for unknown disposition rendering through the public review comment path

Fixes #142

@wwind123
Copy link
Copy Markdown
Owner Author

Implemented the fix for issue #142 in PR #163. _render_disposition_status now falls back to the raw normalized disposition string instead of raising KeyError, and the regression test covers that path through public review comment rendering.

Tests: python3 -m pytest tests/test_agent_loop.py -k "render_public_review_comment or unresolved_item_dispositions" (passed); python3 -m pytest (passed)

-- OpenAI Codex

@wwind123
Copy link
Copy Markdown
Owner Author

Code Review — PR #163: Handle unknown disposition render values

Fixes: #142

Summary

This PR applies the defensive fallback suggested in issue #142 to _render_disposition_status, changing the plain dict access to .get() with the raw disposition string as the default. The change is minimal, targeted, and correct.

Change analysis

orchestrator.py_render_disposition_status

# Before
rendered = labels[disposition.disposition]

# After
rendered = labels.get(disposition.disposition, disposition.disposition)

The fix is correct. _normalize_disposition in protocol.py currently raises AgentLoopError for any value outside the known set (resolved, blocking, same-pr, same-plan, future), so under today's parsing path the KeyError is unreachable. However, the ReviewItemDisposition dataclass can also be constructed directly (e.g., deserialized from stored round metadata via _deserialize_disposition) or built in tests, so the defensive fallback provides genuine safety at the extension boundary identified in #142. Surfacing the raw normalized string is the right default — it's informative rather than silent.

tests/test_agent_loop.pytest_render_public_review_comment_preserves_unknown_disposition_values

The test correctly exercises the new code path end-to-end through _render_public_review_comment, constructing a ReviewItemDisposition with disposition="deferred" directly (bypassing the parser, which is the exact gap the fix guards). The assertion verifies that the rendered output passes through "deferred: tracked for a later parser update" verbatim rather than raising. This is exactly the regression coverage the issue called for.

CI

GitHub checks are pending (test job in_progress) at review time. The author reports a full local pytest run passed. The logic of the change is straightforward enough that CI result is unlikely to diverge, but this review is noted against a pending CI state.

No blocking issues found

The fix precisely matches the recommendation in issue #142, is correctly implemented, and is covered by a well-scoped regression test.

-- Anthropic Claude

@wwind123
Copy link
Copy Markdown
Owner Author

The changes in this PR correctly address the risk of a KeyError in _render_disposition_status by using .get() with a fallback to the raw disposition value. This follows the recommendation from issue #142 to provide a defensive fallback for unrecognised disposition values, making the codebase more resilient to future extensions of the disposition set.

Changes:

  • src/coding_review_agent_loop/orchestrator.py: Updated _render_disposition_status to use labels.get(disposition.disposition, disposition.disposition).
  • tests/test_agent_loop.py: Added test_render_public_review_comment_preserves_unknown_disposition_values to verify that unknown dispositions are rendered correctly using the raw value as a fallback.

Verification:

  • Ran the new test case: test_render_public_review_comment_preserves_unknown_disposition_values passed.
  • Ran all tests in tests/test_agent_loop.py: All 345 tests passed.

The implementation is surgical, well-tested, and aligns with the project's existing patterns.

-- Google Gemini

@wwind123
Copy link
Copy Markdown
Owner Author

GitHub PR checks are still pending for PR #163.

Reviewer approvals do not make this PR merge-ready until GitHub PR checks are green, or the PR explicitly states that only a local subset passed.

  • Pending checks: test (in_progress)
  • Required status checks are not configured on the PR base branch.

-- coding-review-agent-loop

@wwind123 wwind123 merged commit 32d4c31 into main May 25, 2026
1 check passed
@wwind123 wwind123 deleted the codex/fix-issue-142-disposition-fallback branch May 25, 2026 22:04
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.

Follow up future review note: _render_disposition_status uses a plain dict lookup on disposition.disposition with

1 participant