ouroboros/ouroboros/headless_status.py
Ouroboros 57230ee2ef v7next F1: domain D17 - headless split and three test-giant splits, proof-green
headless.py (1573 at tip) gives up its two ledger-assigned leaves again:
ouroboros/headless_status.py (50, 11 symbols) and
ouroboros/workspace_patch_capture.py (668, 19 symbols). All 30 spans are
byte-identical between the reference leaves and git show HEAD bytes — the
hardened transplant --check (mandatory byte gate, undeclared-top-level check,
def681bd) is green on every symbol of both leaves. The facade (947) replays
the oracle's exact edit script over tip bytes: its only divergence from the
reference facade is genuine upstream residue drift (child_ref promotion
machinery, import changes), verified hunk by hunk.

Test splits per the ledger, upstream bytes as truth:
- test_headless_cli.py 2824 -> 462 + five themed siblings + shared fixtures;
  93 test functions preserved exactly (lossless set equality), one adapted
  span kept (the _PATCH_MAX_UNTRACKED_FILE_BYTES monkeypatch retargeted to
  the new leaf, ledger row 739's own adaptation); nine oracle spans carrying
  OTHER domains' v7 spellings reverse-mapped to upstream signatures keyed to
  git show HEAD (registry._run_shell_safety_check string form, tools.core
  _repo_read, queue.init 3-arg, queue.QUEUE_SNAPSHOT_PATH).
- test_workspace_executor.py 1995 -> 541 + three siblings + shared builder;
  two reference spans byte-falsified by upstream drift (06339bb7 readiness
  truth, a849c9a6 probe uncertainty) re-emitted from tip bytes and recorded
  in docs/v7next/LEDGER_CORRECTIONS.md.
- test_agent_task_pipeline.py 1658 -> 1515: only the five ledger-assigned
  _store_task_result rows carved into tests/test_store_task_result.py; the
  other siblings belong to their own lanes.
Thirteen post-cutoff upstream tests have no ledger rows; placed by the
split's theme rule (task_api x4, task_artifacts x1, docker x6, services x2),
disclosed in LEDGER_CORRECTIONS for F5 row-minting.

Pins and mirrors: test_headless_extraction.py transplanted with the
tool_module_inventory clause reduced under an oracle-SHA note (that leaf
belongs to the tools lane); conftest serial table gains the executor family;
the process-custody Popen allowlist row moves headless.py ->
workspace_patch_capture.py with the oracle's justification. All 14 non-split
D17 runtime modules re-proven zero-v7-delta (task_results.py included:
upstream-hot drift stands, no ledger split assigned).

size-ratchet manifest regenerated with the official tool (three test giants
leave GIANT_PATHS, no new band entries); --check green. ruff F clean.
135/105/244/113 tests green in 4-var isolation; HEAD held after every run.

(cherry picked from commit 8dac8303006085bfdb636bacbfc402d6905fae7c)
2026-08-30 17:27:56 +00:00

50 lines
1.9 KiB
Python

"""Artifact and task lifecycle vocabulary shared by the headless owners.
The artifact-status values a task result may carry, the terminal subset the
pruners and the copy-back gate test against, the lifecycle fields a late child
copy-back must preserve, and the two literals headless mirrors instead of
importing (settled task statuses, the local-readonly subagent mode) because a
module-level import of their SSOT would close an import cycle. Constants only:
every consumer of this vocabulary owns its own behaviour.
"""
from __future__ import annotations
ARTIFACT_STATUS_PENDING = "pending"
ARTIFACT_STATUS_FINALIZING = "finalizing"
ARTIFACT_STATUS_READY = "ready"
ARTIFACT_STATUS_READY_WITH_CHANGES = "ready_with_changes"
ARTIFACT_STATUS_READY_NO_CHANGES = "ready_no_changes"
ARTIFACT_STATUS_MISSING = "missing"
ARTIFACT_STATUS_FAILED = "failed"
ARTIFACT_TERMINAL_STATUSES = {
ARTIFACT_STATUS_READY,
ARTIFACT_STATUS_READY_WITH_CHANGES,
ARTIFACT_STATUS_READY_NO_CHANGES,
ARTIFACT_STATUS_MISSING,
ARTIFACT_STATUS_FAILED,
}
# Mirrors task_status.SETTLED_STATUSES; a module-level import would close the
# headless → task_status → outcomes → headless cycle, and the smoke test below
# pins equality so the literal cannot drift from the SSOT.
_FINAL_STATUSES = frozenset({"completed", "failed", "cancelled", "rejected_duplicate"})
# Mirrors tool_capabilities.LOCAL_READONLY_SUBAGENT_MODE; a module-level import would risk
# an import cycle (same rationale as _FINAL_STATUSES above), and the smoke test pins equality
# so the literal cannot drift from this SSOT — the kind of re-derivation drift that stranded
# the reaper's artifact finalization before task_is_readonly_subagent consolidated the gate.
_LOCAL_READONLY_SUBAGENT_MODE = "local_readonly_subagent"
_ARTIFACT_LIFECYCLE_FIELDS = {
"artifact_status",
"artifact_error",
"artifact_bundle",
"artifact_finalized_at",
}