Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/sandbox-executor/src/sandbox_executor/agent_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

FALLBACK_AGENT = "antigravity-agent"

# why: legacy defaults describe what produced historical records, so never follow runtime detection.
LEGACY_DEFAULT_AGENT = "antigravity-agent"

AGENT_IMAGE_MAPPING: dict[str, str] = {agent_id: spec.image for agent_id, spec in RUNNER_SPECS.items()}

# why: a ticker is never reassigned or reused and has no fallback; a runner without one is omitted.
AGENT_TICKERS: dict[str, str] = {
agent_id: spec.ticker for agent_id, spec in RUNNER_SPECS.items() if spec.ticker is not None
}
Expand Down Expand Up @@ -161,6 +163,7 @@ def detect_runner_auth_status(agent: str, environ: Mapping[str, str] | None = No
for marker, match_kind in spec.harness_markers
)

# why: these are credentials or user settings, never harness markers even when they match a prefix.
NON_MARKER_VARS: frozenset[str] = frozenset().union(*(spec.non_marker_env_vars for spec in RUNNER_SPECS.values()))
_CREDENTIAL_SUFFIXES: tuple[str, ...] = ("_KEY", "_TOKEN", "_SECRET", "_PASSWORD")
_FALSY_VALUES = frozenset({"", "0", "false", "no", "off"})
Expand Down
4 changes: 4 additions & 0 deletions apps/sandbox-executor/src/sandbox_executor/budgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from sandbox_executor.budgets_timer import current_stage_timer as current_stage_timer
from sandbox_executor.budgets_timer import format_minutes as format_minutes
from sandbox_executor.budgets_timer import format_stage_summary as format_stage_summary

# why: stage_budget_handdown_env hands nothing down for a non-finite code-built timer; load_budgets never yields one.
from sandbox_executor.budgets_timer import stage_budget_handdown_env as stage_budget_handdown_env

logger = logging.getLogger(__name__)
Expand All @@ -44,6 +46,7 @@

ENV_REVIEW_CI_WAIT = "HOLON_REVIEW_CI_WAIT_SECONDS"

# why: CI wait sits outside the review iteration budget so a slow CI runner never consumes reviewer time.
DEFAULT_REVIEW_CI_WAIT_SECONDS = 1800.0
DEFAULT_TURN_SECONDS = 3600.0
DEFAULT_STALL_SECONDS = 90.0
Expand Down Expand Up @@ -214,6 +217,7 @@ def describe_budgets(budgets: Budgets) -> list[str]:

DEFAULT_ENTROPY_BUDGET = 15.0
MAX_REPLAN_ATTEMPTS = 2
# why: replan feedback is transient and is never written to a ledger.
ENV_REPLAN_FEEDBACK = "HOLON_REPLAN_FEEDBACK"
ENV_REPLAN_FEEDBACK_FILE = "HOLON_REPLAN_FEEDBACK_FILE"
REPLAN_FEEDBACK_INLINE_MAX_BYTES = 32 * 1024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
),
)

# why: the host sets these per role container or a maintainer per run; a layer file never needs them.
HOST_SET_KEYS: tuple[str, ...] = (
"HOLON_ROLE",
"HOLON_CONFIG_RESOLVED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
RERUN_RUN_TIMEOUT_SECONDS = 30.0
CI_CHECK_FIELDS = "bucket,name,state,event,workflow,link"
MERGEABILITY_FIELDS = "number,mergeable,mergeStateStatus,statusCheckRollup"
# why: the only gh pr merge method flags allowed; never --rebase, --auto or --admin.
ALLOWED_MERGE_FLAGS = ("--merge", "--squash")

_PR_VIEW_FIELDS = "number,title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def _unresolved_ref_result(repo_dir: str, role: str, ref: str, candidates: list[
def _local_mergeability(repo_dir: str, clean_branch: str, target_branch: str) -> dict[str, Any]:
try:
resolved_commits: dict[str, str] = {}
# why: merge-tree exits 1 for a conflict and for a bad ref alike, so both refs must resolve to commits first.
for role, ref, candidates in _local_candidate_refs(repo_dir, clean_branch, target_branch):
sha, rp_stderr = _resolve_commit_ref(repo_dir, ref)
if sha is None:
Expand Down
2 changes: 1 addition & 1 deletion apps/sandbox-executor/src/sandbox_executor/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def branch_exists(repo_dir: str, branch_name: str, check_remote: bool = True) ->
EMPTY_DIFF_FAILURE_REASON: str = "empty_diff"

METADATA_PATH_PREFIXES: tuple[str, ...] = (
*EMPTY_DIFF_EXCLUDES,
*EMPTY_DIFF_EXCLUDES, # why: metadata never counts as code in the guard, review diff summary or calibration
"holon-knowledge/",
".holon/",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

# why: brain/ and conversations/ must stay writable for agy's OnTaskCompleted wakeup and runtime state.
from sandbox_executor.runners.antigravity import ANTIGRAVITY_WRITABLE_TMPFS as ANTIGRAVITY_WRITABLE_TMPFS
from sandbox_executor.runners.antigravity import antigravity_session_mounts as antigravity_session_mounts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ContainerLaunch:
intent_file: str | None = None
token_reduce: bool = False
mitm_web: bool = False
# why: proxy attach reuses a proxy the user already runs (port-probe hit) and never spawns a sidecar.
proxy_attach: bool = False
target_worktree: str | None = None
result_file: str | None = None
Expand All @@ -65,6 +66,7 @@ def run(self) -> int:
self.workspace()
except _LaunchAborted as aborted:
return aborted.exit_code
# why: env-file, sidecar and agent dir exist once credentials start; every exit path must run teardown.
try:
self.credentials()
self.docker_cmd.extend(proxy_paths._gateway_host_args())
Expand Down Expand Up @@ -100,6 +102,7 @@ def credentials(self) -> None:
self.role, self.agent_id, pin_workspace=bool(self.workspace_mounts)
)
self._stage_replan_feedback()
# why: a forwarded HOLON_* value may hold a non-UTF-8 byte (surrogateescape); it must not crash the run.
for key, value in sorted(self.forwarded_env.items()):
self._add_env(key, value)

Expand Down Expand Up @@ -164,6 +167,7 @@ def env_file(self) -> None:
except ValueError as exc:
print(f"Error: {messages.redact_cli_error(exc)}.", file=sys.stderr)
raise _LaunchAborted(1) from exc
# why: an env-file write failure ends in a clean error, never a traceback or credentials on the argv.
except OSError as exc:
print(f"Error: could not write the credential env-file: {messages.redact_cli_error(exc)}.", file=sys.stderr)
raise _LaunchAborted(1) from exc
Expand Down
64 changes: 64 additions & 0 deletions executions/E-1796129718-CLA-CO5.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Execution Record: E-1796129718-CLA-CO5.5

## Summary

Restore 15 lost reason comments as `# why:` comments across 8 source modules (comment-only, AST-identical to
`origin/main`).

## Actual Metrics

| metric | value |
| --------------------- | ----- |
| success_actual | 1.0 |
| entropy_actual | 1.5 |
| impact_actual | 30.0 |
| cost_actual | 4.0 |
| learning_value_actual | 1.0 |

## Steps Executed

### Step 1: Insert the 15 `# why:` comments

Committed as `Step 1: restore 15 why comments across 8 modules`. Outcome: restored = 15, shown-by-code/moved = 0. Two
anchors are re-exports whose definitions moved out of scope: `ANTIGRAVITY_WRITABLE_TMPFS` (defined in
`runners/antigravity.py`, comment sits above its re-export in `launcher/antigravity_mounts.py`) and
`stage_budget_handdown_env` (defined in `budgets_timer.py`, comment sits right after the `budgets.py` import block and
names the symbol, so the sorted import group is not split).

| # | file | old line | text (abridged) | outcome | new line |
| --- | ------------------------------ | -------- | ------------------------------------------------------------------------ | -------- | -------- |
| 1 | launcher/containers.py | 57 | Attach to a proxy the user already runs; never spawns a sidecar | restored | 47 |
| 2 | launcher/containers.py | 89 | every remaining exit path, early returns included, must run teardown | restored | 69 |
| 3 | launcher/containers.py | 98 | A forwarded HOLON\_\* value may hold a non-UTF-8 byte | restored | 105 |
| 4 | launcher/containers.py | 169 | rather than a traceback, never credentials on the argv | restored | 170 |
| 5 | launcher/antigravity_mounts.py | 6 | brain/ and conversations/ must be writable for agy | restored | 3 |
| 6 | agent_defaults.py | 33 | legacy defaults must never follow runtime detection or defaults | restored | 14 |
| 7 | agent_defaults.py | 46 | A ticker is never reassigned or reused, and there is no fallback | restored | 19 |
| 8 | agent_defaults.py | 364 | Variables that never count as harness markers even on a prefix match | restored | 166 |
| 9 | budgets.py | 61 | a slow CI runner never consumes reviewer time | restored | 48 |
| 10 | budgets.py | 431 | Only a timer built in code can get here; hand nothing down | restored | 31 |
| 11 | budgets.py | 447 | The feedback is transient: it is never written to a ledger | restored | 219 |
| 12 | flow/github/adapter.py | 37 | The only `gh pr merge` method flags; never `--rebase`/`--auto`/`--admin` | restored | 24 |
| 13 | flow/github/pr.py | 166 | both refs must resolve before a merge is simulated; merge-tree exits 1 | restored | 111 |
| 14 | config_env_keys.py | 96 | Keys the host sets for a role container; a layer file never needs them | restored | 92 |
| 15 | git.py | 474 | never count as code in the guard, review diff summary or calibration | restored | 355 |

### Step 2: Prove comment-only, run gates and tests

`ast.dump(ast.parse(...))` equals `origin/main` for all 8 modules. Line counts: containers.py 270, antigravity_mounts.py
5, agent_defaults.py 343, budgets.py 263, adapter.py 140, pr.py 185, config_env_keys.py 112, git.py 432. Every added
line is at most 120 chars. No test file and no `module_budgets.json` change.

## Tests Run

| command | result |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| AST equality check vs `origin/main` (8 files) | all equal |
| `uv run ruff format --check .` | 883 files already formatted |
| `uv run ruff check .` | all checks passed |
| `uv run python scripts/check_module_budgets.py` | passed (439 modules) |
| `uv run python scripts/check_self_explaining.py` | passed |
| focused `uv run pytest -n auto --dist worksteal` (15 test files) | 909 passed, 14 subtests, 5.59s |
| `uv run task lint` | passed |
| `uv run task lint-docs` | failed: 36 pre-existing `plans/` files, none touched here; this notes file passes prettier |
| `uv run task test` (single run) | 11204 passed, 8 skipped, 86.95s (median 86.95s) |
21 changes: 21 additions & 0 deletions holon-knowledge/kb/failure_modes/KB-failure-be896549.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"kb_id": "KB-failure-be896549",
"kb_type": "failure_mode",
"version": "1.0",
"created_ts": "1970-01-01T00:00:00+00:00",
"updated_ts": "1970-01-01T00:00:00+00:00",
"created_by": "holon-promotion-engine",
"status": "active",
"evidence": {},
"tags": [
"general",
"veto"
],
"human_approved": false,
"payload": {
"name": "Failure mode in I-1796129577-hac-restore-why-src-batch2/P-1796129600-CLA-CO5.5/_",
"description": "Reproduced failure across executions with identical context. Execution counts live in the action index and ledgers.",
"action": "Review Loop halted without consensus after 2 iteration(s); final verdicts: Reviewer 1 APPROVED (0/0/0); Reviewer 2 APPROVED (0/0/0); Reviewer 3 APPROVED (0/0/0)",
"symptoms": []
}
}
Loading
Loading