4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""Boot-time import-budget guardrails for the interactive shell.
|
|
|
|
These lock in the lazy-loading wins so a future eager import in the boot path
|
|
(controller construction, banner, background workers, prompt/completion) fails
|
|
loudly instead of silently re-inflating REPL startup.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
|
|
# Modules that must NOT be pulled into the graph merely by importing the REPL
|
|
# entrypoint. Each maps to the lazy-loading change that keeps it out.
|
|
_FORBIDDEN_AT_BOOT: tuple[str, ...] = (
|
|
# Harness/turn-execution stack — deferred until the first turn is dispatched.
|
|
"surfaces.interactive_shell.runtime.shell_turn_execution",
|
|
"core.agent.agent",
|
|
"core.agent_harness.turns.action_driver",
|
|
# Email delivery — only loads on background-RCA completion.
|
|
"integrations.smtp.delivery",
|
|
)
|
|
|
|
|
|
def _modules_loaded_by(import_target: str, candidates: tuple[str, ...]) -> list[str]:
|
|
check = "; ".join(f"print('{name}', '{name}' in sys.modules)" for name in candidates)
|
|
result = subprocess.run(
|
|
[sys.executable, "-c", f"import sys; import {import_target}; {check}"],
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
loaded: list[str] = []
|
|
for line in result.stdout.splitlines():
|
|
name, _, flag = line.partition(" ")
|
|
if flag.strip() == "True":
|
|
loaded.append(name)
|
|
return loaded
|
|
|
|
|
|
def test_repl_boot_import_stays_lazy() -> None:
|
|
loaded = _modules_loaded_by(
|
|
"surfaces.interactive_shell.main",
|
|
_FORBIDDEN_AT_BOOT,
|
|
)
|
|
assert loaded == [], (
|
|
"importing surfaces.interactive_shell.main eagerly pulled modules that "
|
|
f"must load lazily: {loaded}"
|
|
)
|