Skip to content

Commit f0cd73b

Browse files
author
codejunkie99
committed
fix(harness_manager): support Python 3.9 (closes #27)
Fixes the immediate crash @WhoLsJohnGalt reported: every brew user on macOS-default Python 3.9 hits File ".../harness_manager/schema.py", line 190, in <module> def validate(manifest_path: Path | str) -> dict: TypeError: unsupported operand type(s) for |: 'type' and 'type' immediately after `brew install agentic-stack`. PEP 604 union syntax (`Path | str`) requires Python 3.10+ at runtime; the macOS Command Line Tools default is still 3.9. There are 25 such annotations across 8 files in `harness_manager/`. Rather than rewrite each to `Union[Path, str]` / `Optional[X]`, this commit adds `from __future__ import annotations` (PEP 563) to each affected file so all annotations are stored as strings and never evaluated at import time. Works on Python 3.7+, which covers every macOS-shipped Python in the wild. Files changed (all `harness_manager/`): schema.py state.py install.py remove.py post_install.py manage_tui.py doctor.py status.py Audited the rest of the repo: no PEP 604 syntax in `.agent/`, `onboard*.py`, or any other Python touchpoint, so no other module needs the same treatment. The reporter's suggested fix (declare `python@3.10` as a brew dep + pin the binary in install.sh) would also work but pulls in ~150 MB on every brew install and conflicts with users who manage their own python (pyenv, asdf). The future-annotations approach is zero-cost and benefits non-brew users (Linux, manual clone) on system Python 3.9 too.
1 parent 8985eb5 commit f0cd73b

8 files changed

Lines changed: 16 additions & 0 deletions

File tree

harness_manager/doctor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from filesystem signals and ASKS before synthesizing — never silently
99
writes. Codex's UX framing: doctor must not mutate without consent.
1010
"""
11+
from __future__ import annotations
12+
1113
import os
1214
import shutil
1315
import sys

harness_manager/install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
post_install actions to a target project, records what was done in
55
.agent/install.json. install.sh and install.ps1 dispatch into here.
66
"""
7+
from __future__ import annotations
8+
79
import shutil
810
import sys
911
from pathlib import Path

harness_manager/manage_tui.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
for consistency with the existing wizard. No new UI primitives
1010
beyond the multi-select widget added at the same time.
1111
"""
12+
from __future__ import annotations
13+
1214
import os
1315
import shutil
1416
import signal

harness_manager/post_install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
codex review of the v1.0 vision plan flagged generalized run_command as
99
DSL creep; named built-ins are the constrained alternative.
1010
"""
11+
from __future__ import annotations
12+
1113
import hashlib
1214
import os
1315
import platform

harness_manager/remove.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
quarantine — codex UX framing: don't over-help, no undo machinery
55
to learn or trust). User runs `git reset` if they want recovery.
66
"""
7+
from __future__ import annotations
8+
79
import shutil
810
import sys
911
from pathlib import Path

harness_manager/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
python3 with no pip step. A 50-line recursive checker is cheaper than
66
adding a `jsonschema` dependency.
77
"""
8+
from __future__ import annotations
9+
810
import json
911
from pathlib import Path
1012
from typing import Any

harness_manager/state.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
the _episodic_io flock pattern is the wrong abstraction for install.json
77
because of read-modify-write — this module uses the right one.
88
"""
9+
from __future__ import annotations
10+
911
import json
1012
import os
1113
import tempfile

harness_manager/status.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Same content as the manage menu's header pane in the v1.0 vision —
44
shipped here as a discrete subcommand instead of a TUI element.
55
"""
6+
from __future__ import annotations
7+
68
from pathlib import Path
79
from typing import Callable
810

0 commit comments

Comments
 (0)