Skip to content

fix(execution): add SCOPE_TOO_WIDE enum value and guard artifact_writer .value call - #281

Merged
ProtocolWarden merged 1 commit into
mainfrom
oc-watchdog/20260613-1838-artifact-writer-scope-too-wide
Jun 13, 2026
Merged

fix(execution): add SCOPE_TOO_WIDE enum value and guard artifact_writer .value call#281
ProtocolWarden merged 1 commit into
mainfrom
oc-watchdog/20260613-1838-artifact-writer-scope-too-wide

Conversation

@ProtocolWarden

Copy link
Copy Markdown
Owner

Summary

  • Add SCOPE_TOO_WIDE = "scope_too_wide" to FailureReasonCategory enum in contracts/enums.py
  • Guard artifact_writer.py .value call to handle string values safely
  • Fix workspace.py to use the enum member instead of raw string

Root Cause

WorkspaceManager.finalize() sets failure_category = "scope_too_wide" (a string), but artifact_writer.py calls .value on it expecting an enum member. This caused AttributeError: 'str' object has no attribute 'value' in the review watcher logs.

Test plan

  • Unit tests pass: pytest tests/unit/er000_phase0_golden/ tests/unit/execution/ tests/unit/entrypoints/ -q (1334 passed)
  • Ruff clean: 0 violations
  • Custodian pre-push: 0 findings

🤖 Generated with Claude Code

…er .value call

Root cause: workspace.py set failure_category to literal string "scope_too_wide"
because FailureReasonCategory lacked the SCOPE_TOO_WIDE member. Pydantic stored it
as a plain str; artifact_writer.py then crashed with AttributeError when calling
.value on the string (reproduced in review watcher log at 12:39:58 UTC 2026-06-13).

Three-file fix:
- contracts/enums.py: add SCOPE_TOO_WIDE = "scope_too_wide" to FailureReasonCategory
- execution/workspace.py: import FailureReasonCategory; use enum member instead of str
- execution/artifact_writer.py: guard fc.value with hasattr check as defensive belt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ProtocolWarden
ProtocolWarden merged commit b145152 into main Jun 13, 2026
17 checks passed
@ProtocolWarden
ProtocolWarden deleted the oc-watchdog/20260613-1838-artifact-writer-scope-too-wide branch June 13, 2026 22:10
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.

1 participant