Orchestrata Ultimate › Plans › briefs › 2026-10-13-review-fix-hook-except-tuples-and-mcp-brief-transport-line
Brief: review fix — the AST sync hook's except tuples are parenthesized in both copies, and the MCP gateway brief's FILES entry says WebSocket
Source: plans/briefs/2026-10-13-review-fix-hook-except-tuples-and-mcp-brief-transport-line.md at 8a2cb42ad · last changed 2026-10-13 · first committed 2026-10-13 · 36 lines.
Prose pending.
Plan text
Brief: review fix — the AST sync hook's except tuples are parenthesized in both copies, and the MCP gateway brief's FILES entry says WebSocket
Date: 2026-10-13 · DESIGN_WAIVER: ADR-0097 (Accepted: the resident AST daemon publishes the snapshot; the post-edit hooks stop re-serializing) and ADR-0099 rule 1 (Accepted: the gateway MCP transport is a WebSocket JSON-RPC client) · Origin: adversarial review by Qwen 3.8 Max of the day's work, findings 1, 2 and 4, verified by the coordinator against origin/master c3752887b · Executor: DeepSeek 4 Pro (first external builder assignment) in worktree /home/mohamed/workspace/orchestrata-ultimate-worktrees/review-fix-deepseek on branch fix/review-hook-except-tuples · Design settled below; if a fork appears, STOP and report.
GOAL: the hook parses under every CPython 3.11+ the platform might run it with, not only 3.14, and the brief no longer carries a pre-ruling transport sentence.
VERIFIED (coordinator, origin/master c3752887b):
claude/hooks/ast_sync_hook.pylines 332, 428, 452 and 547 use the unparenthesized formexcept OSError, subprocess.SubprocessError:andexcept json.JSONDecodeError, ValueError:. CPython 3.14 accepts it (PEP 758), and the deployed hook runs under~/.claude/.venv/bin/python3.14.7, so the hook is not dead today; CPython 3.13 rejects it with "multiple exception types must be parenthesized".plugins/orchestrata/hooks/ast_sync_hook.pyis byte-identical to the first copy (git diff between the two blobs is empty) and must stay so.plans/briefs/2026-10-13-mcp-gateway-transport-and-deployed-registration.mdline 20 still says "runs each call against the running gateway over its existing HTTP surface at the deployed address, never in-process"; ADR-0099 rule 1 (docs/adr/0099-*.md, Accepted) rules a WebSocket JSON-RPC client. The brief's later RULED DESIGN section already says WebSocket; only the FILES sentence is stale.- Hook tests live under
tests/claude/; this repo's rulings forbid mocks, monkeypatch and skips (RUL-002) and forbid pytest-xdist (RUL-001).
FILES (repo-relative): Modify:
- claude/hooks/ast_sync_hook.py — the four
exceptclauses becomeexcept (OSError, subprocess.SubprocessError):andexcept (json.JSONDecodeError, ValueError):. Nothing else changes. - plugins/orchestrata/hooks/ast_sync_hook.py — the same four edits so the two files stay byte-identical.
- plans/briefs/2026-10-13-mcp-gateway-transport-and-deployed-registration.md line 20 — replace "over its existing HTTP surface at the deployed address" with "over a WebSocket JSON-RPC connection to the running gateway at the deployed address (ADR-0099 rule 1)". Create:
- tests/claude/test_ast_sync_hook_parses_everywhere.py — parses both hook files with
ast.parseunderfeature_version=(3, 11)(which rejects PEP 758 syntax) and asserts the two files are byte-identical.@tracesthe REQ id the existing hook tests intests/claude/cite for ADR-0097, or none if they cite none. Read-only: docs/adr/0097-.md, docs/adr/0099-.md, tests/claude/test_ast_incremental_refresh_hook.py, scripts/hooks/pre-commit.
CONSTRAINTS:
- Read Python source through the AST toolkit, not by cat/sed/grep:
direnv exec <worktree> uv run python scripts/serialize_codebase_ast.py source <qualified_name>; a plain text tool on a.pyfile is blocked in this repository. Markdown may be read with any tool. direnv exec /home/mohamed/workspace/orchestrata-ultimate-worktrees/review-fix-deepseek uv run …for every command (never.venv/bin/..., never system python, never pip).- Tests observed:
timeout 300 direnv exec <worktree> uv run pytest-live tests/claude/test_ast_sync_hook_parses_everywhere.py tests/claude/test_ast_incremental_refresh_hook.py --basetemp=/var/tmp/ct-deepseek/v. Never re-run an unchanged red. - The real git pre-commit hook runs on commit (secrets check, ruff, review-staged); do not pass
--no-verify. Commits by Mohamed (the configured author), stage by name, no AI attribution lines; never commitplans/ast-*.json,docs/CODEBASE_MAP*.mdor.claude/. - No deploy, no install, no daemon restart; the deployed hook is updated by the coordinator through
deploy/install-claude-config.shafter ship.
DONE WHEN:
- The new test and the existing hook test are green under
timeout 300, observed. direnv exec <worktree> uv run ruff check claude/hooks/ast_sync_hook.py plugins/orchestrata/hooks/ast_sync_hook.py tests/claude/test_ast_sync_hook_parses_everywhere.pyclean.cmp claude/hooks/ast_sync_hook.py plugins/orchestrata/hooks/ast_sync_hook.pyprints nothing.git status --shortempty on the branch; one commit through the real pre-commit hook naming the findings it closes.
VERIFY: the pytest-live summary line; the ruff line; the empty cmp output; git log --oneline -1.
Report back with those four observed outputs and anything that stopped you.