Make the subagent JSONL reader honor one stable result contract
Severity: low | Confidence: 1 | Effort: S
Where:
- core/pysrc/_subagentslib.py:91-109
- core/pysrc/_subagentslib.py:120-162
- core/pysrc/statusline.py:647-654
Evidence: read_subagents() documents and normally returns a four-item tuple, but its directory-error branch returns three items. It also decodes each JSONL line and immediately calls .get() without requiring an object. Live temporary-directory calls reproduced (0, [], (0, 0)) for a missing directory and AttributeError: 'list' object has no attribute 'get' for the valid JSON line []. The statusline then either fails tuple unpacking or has the exception swallowed by safe(), hiding the entire subagent section.
Impact: A normal directory race or one syntactically valid non-object event can erase all subagent visibility from the rich statusline without a useful diagnostic. Direct callers also cannot rely on the function's documented tuple shape, making future reuse and extension modes prone to unpacking failures.
Recommendation: Define one explicit result shape for read_subagents() and return it on every path. Parse JSONL values as unknown, skip non-mapping records before field access, and keep file-local corruption isolated so later valid records still contribute.
Acceptance criteria:
- Every return path produces the documented four-item result with stable element types.
- Missing directories, directory races, and per-file stat/open failures return a valid empty or partial result without exception.
- Null, array, scalar, malformed, and object JSONL records can coexist; invalid records are skipped and later valid records are still counted.
- Statusline tests cover the missing-directory path and mixed-shape JSONL without suppressing valid subagent rows.
Make the subagent JSONL reader honor one stable result contract
Severity: low | Confidence: 1 | Effort: S
Where:
Evidence:
read_subagents()documents and normally returns a four-item tuple, but its directory-error branch returns three items. It also decodes each JSONL line and immediately calls.get()without requiring an object. Live temporary-directory calls reproduced(0, [], (0, 0))for a missing directory andAttributeError: 'list' object has no attribute 'get'for the valid JSON line[]. The statusline then either fails tuple unpacking or has the exception swallowed bysafe(), hiding the entire subagent section.Impact: A normal directory race or one syntactically valid non-object event can erase all subagent visibility from the rich statusline without a useful diagnostic. Direct callers also cannot rely on the function's documented tuple shape, making future reuse and extension modes prone to unpacking failures.
Recommendation: Define one explicit result shape for
read_subagents()and return it on every path. Parse JSONL values as unknown, skip non-mapping records before field access, and keep file-local corruption isolated so later valid records still contribute.Acceptance criteria: