Repository navigation
Fail Closed on a Malformed inheritingAgentTypes in the Tier Guard - #4293
Conversation
load_tiers lower-cased each inheritingAgentTypes entry outside its try, so a non-string entry raised and the hook's non-zero exit let the dispatch through. A string or dict value iterated silently into the wrong set. The value must now be a list of strings, and anything else reads as an unreadable mapping, which refuses every dispatch naming a model. Closes #4291 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🔵 Needs a closer look
Maintainer review is needed because the change alters a host safety hook’s fail-closed handling of malformed deployment data, despite passing automated tests.
No open issues 🎉
What changed in this PR
This PR hardens the Claude Code tier guard against malformed inheritingAgentTypes configuration by treating invalid values as unreadable and preserving fail-closed behavior for model-bearing dispatches.
Changes:
- Validate that
inheritingAgentTypesis a list containing only strings. - Document malformed configuration as an unreadable state.
- Add tests covering malformed lists, nulls, strings, mappings, and numbers.
| File | Description |
|---|---|
| host-setup/agent-safety/claude/test_model_tier_guard.py | Adds coverage verifying fail-closed behavior for malformed inheritingAgentTypes values. |
| host-setup/agent-safety/claude/model-tier-guard.py | Validates inheritingAgentTypes configuration and documents the resulting fail-closed behavior. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4293 +/- ##
========================================
Coverage 78.95% 78.95%
========================================
Files 42 42
Lines 15625 15625
========================================
Hits 12337 12337
Misses 3288 3288
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action performed
|
|
Copilot round on 57d57fa, headline "Needs a closer look: Maintainer review is needed because the change alters a host safety hook's fail-closed handling of malformed deployment data" (0 open findings, "No open issues"). No change needed: the headline names no defect. It restates that the diff touches |
…pes and Close Further Retired-Path Edges (#4296) ## Summary Promotes `develop` to `main`. It carries these changes: - [#4293](#4293) makes the tier guard fail closed on a malformed `inheritingAgentTypes`. - **Declined points.** A list-valued `models` raises a `TypeError` the existing `try` catches, and a deep-nesting `RecursionError` is outside the hook's stated scope. The hook runs standalone and cannot import `is_str_list`. Empty or duplicate names do no harm in the hook. - [#4295](#4295) closes further latent edges in the retired-path checks. Its body lists 7 declined edges with evidence under "Declined edges", and #4294 tracks the two leftover edges. Closes #4291 Closes #4285 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
load_tiersin the tier guard lower-cased eachinheritingAgentTypesentry outside itstry. A non-string entry raisedAttributeError. The hook exited non-zero, and Claude Code treats a hook error as allow, so the dispatch went through. A bare string or a mapping never raised, but it iterated silently into a set of characters or keys.The value must now be a list of strings. Anything else is read as an unreadable mapping. That is the hook's existing fail-closed state: every dispatch naming a model is refused, and one naming none is allowed, as the module docstring states for a missing config. The docstring now names this case too.
No current input reaches this.
spec/validate.pychecks the key's shape, and the deployed mapping is a copy of the validated file. It takes a hand-edited or partially deployed mapping.Verification
test_a_malformed_inheriting_list_is_treated_as_missingcovers a non-string entry, anullentry, a bare string, a mapping and a number. Against the previous hook all five subtests fail. With the fix the whole suite passes, 26 tests, and--selftestpasses.ruff check,ruff format --check, mypy and the prose gate pass in the pre-commit hook.local-strict-reviewpass at thefrontiertier is recorded againstdevelopwith no findings.The maintainer reads this diff before it merges, since it changes
host-setup/agent-safety/.Closes #4291
🤖 Generated with Claude Code
Summary by CodeRabbit