Repository navigation
fix: select wake response aliases by name - #21
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is a minimal, behavior-preserving refactor that correctly removes a positional assumption, with no other code depending on that ordering.
0 open findings
What changed in this PR
This PR hardens the wake-hook response alias selection in hooks/debate_wake.py. Previously, _extract_tool_response built its alias list using the positional slice _HOOK_RESPONSE_KEYS[1:], which implicitly assumed the canonical "tool_response" key always occupies index 0. The change replaces that positional assumption with an explicit name-based exclusion (key != "tool_response"), so any future reordering of _HOOK_RESPONSE_KEYS still correctly includes all aliases while excluding the separately handled canonical key. This addresses an optional maintainability comment from PR #19.
Changes:
- Replace the fragile positional slice
_HOOK_RESPONSE_KEYS[1:]with an explicit, name-based filter that excludes"tool_response". - Preserve existing behavior: canonical
tool_responseis still handled first, and remaining aliases are normalized via_normalize_tool_response.
| File | Description |
|---|---|
| hooks/debate_wake.py | Selects response aliases by name rather than by tuple position, removing an implicit ordering dependency in _extract_tool_response. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The response-alias fallback relied on
tool_responseoccupying the first tuple position. Select aliases by name so future reordering of_HOOK_RESPONSE_KEYSpreserves all supported aliases and explicitly excludes the separately handled canonical key.This addresses the optional maintainability comment on PR #19. The change is confined to
hooks/debate_wake.py.Validation: the existing payload-normalization and wake-regression suites pass (51 tests), repository Ruff checks pass, and
git diff --checkpasses. GitHub CI will validate the full suite on Python 3.11.