Skip to content

RTM-0: characterization tests, hermetic test lane, locked CI, and runtime ADR (proposed) - #8

Open
svngoku wants to merge 16 commits into
masterfrom
rtm-0/runtime-modernization
Open

svngoku wants to merge 16 commits into
masterfrom
rtm-0/runtime-modernization

Conversation

@svngoku

@svngoku svngoku commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

RTM-0 of the Evaluation-Driven Agent Runtime Modernization roadmap: pin today's runtime behavior with tests, make the default test lane hermetic, lock CI dependencies, and propose the architecture decision that later phases build on. No production code changes in agentic_internet/.

The ADR, Keep SmolAgents behind a project-owned reliability layer, is proposed, not accepted. It is here for review. Approval is tracked as agentic-internet-8xh.

Summary

docs/
├── design-docs/2026-12-04-smolagents-behind-reliability-layer.md   # ADR (status: proposed)
├── exec-plans/active/2026-12-04-evaluation-driven-agent-runtime.md # RTM-0..RTM-8 roadmap
├── design-docs/index.md, PLANS.md                                  # index rows
tests/
├── conftest.py                                    # hermetic default lane
├── fixtures/mcp_echo_server.py                    # local stdio MCP server
├── test_hermetic_fixtures.py                      # tests for the isolation itself
├── test_mcp_lifecycle.py                          # real MCP start/list/call/shutdown
├── test_internet_agent_characterization.py        # pins InternetAgent behavior
├── test_cli_characterization.py                   # pins CLI exit codes/output
└── test_multi_model_characterization.py           # pins multi-model runtime behavior
.github/workflows/ci.yml, pyproject.toml, uv.lock  # locked install, SHA-pinned actions, smolagents floor

ADR decision. Keep SmolAgents as the execution engine. Add a thin runtime/ control plane that owns typed results, terminal states, budgets, cancellation, retries, fallback recording, and run isolation. Rejected alternatives:

Alternative Why rejected
Rewrite on another framework The defects are in project code, SmolAgents 1.21.2 already has the needed hooks, and a rewrite needs new parity evidence for every path at once.
Expand multi-agent first No single- vs multi-agent baseline shows uplift, and more workers multiply the unenforced-limit and shared-state defects.
Keep patching individually PR #7 was targeted patching, and the lifecycle defects remain.

Characterization tests. They pin current behavior. Defects that are still present are tagged with the phase meant to fix them, so those future changes show up as intentional test updates:

Still present (pinned, tagged) Location Phase
Timeout message reports None seconds multi_model/system.py:444 RTM-6
One shared current_task_context; overlapping runs overwrite it multi_model/system.py:306 RTM-6
required=True workers skipped without error multi_model/system.py:136-138 RTM-6
Worker failures returned as ordinary tool output multi_model/tools.py:441 RTM-6
--workers accepted but never used cli.py:184 RTM-6
run() returns failures as strings; CLI exits 0 on them internet_agent.py:186-191 RTM-5

Behavior fixed upstream in PR #7 (max_steps/planning_interval forwarding, tools=[] honored) is pinned as fixed.

Hermetic default lane (tests/conftest.py, standard library only):

  • .env is never loaded, and provider/MCP credentials are cleared before the package is imported and before every test.
  • Tests not marked integration cannot open non-loopback connections or do DNS lookups; loopback and pipes stay allowed.
  • --strict-markers is enabled.

CI and dependencies:

  • uv sync --locked.
  • actions/checkout, actions/setup-python, and trufflehog pinned to full commit SHAs. trufflehog moves off main to v3.100.1, and its scanner image is pinned to 3.100.1 because the action's version input otherwise pulls latest. setup-uv was already pinned upstream.
  • smolagents[mcp]>=0.1.0 → >=1.21.2, the version whose APIs were verified. uv.lock changes only that specifier; no resolved versions change.

Evidence

Measured locally with uv 0.13.7 on macOS, Python 3.11. "Before" is master at 589a0c1; "after" is this branch at b400485. Tests and code are unchanged since 6f18a40; b400485 only adds the scanner pin.

Check Before (master) After (this PR)
uv run pytest -W error::DeprecationWarning 250 passed, 1 skipped 325 passed, 1 skipped (+75 RTM-0 tests)
uv run pytest -m "not integration" — 324 passed, 2 deselected
Total line coverage (--cov=agentic_internet) 65% 72%
ruff check agentic_internet tests — All checks passed
ruff format --check agentic_internet tests — 63 files already formatted
mypy agentic_internet — No issues in 30 source files
uv lock --check / uv sync --locked --dry-run — Up to date / would make no changes
golden_principles.py — Passed

CI on this PR (run 47445452500) reproduces it: uv sync --locked installs cleanly, 325 passed and 1 skipped, lint, format, mypy and golden checks pass, and the secret scan runs trufflehog:3.100.1.

The full suite passed on 3 repeated local runs with no leftover MCP server processes. The new tests use fakes only; none needs network access or API keys.

Merge with PR #7 (stabilization baseline)

This branch started before PR #7 and was synced with master at 55566a7:

  • Conflicts resolved: ci.yml keeps upstream's setup-uv v10.3.3 / uv 0.13.7 pin. PLANS.md uses upstream's table format. Upstream keeps tests/test_internet_agent.py, and ours became test_internet_agent_characterization.py.
  • Tests re-pinned: 3 InternetAgent tests now pin the behavior PR fix: stabilize execution and consolidate repository structure #7 fixed. One test that duplicated upstream was dropped and replaced by a tools=None test. Multi-model fakes were retargeted to agents/multi_model/system.py, with guards that prove the patches take effect.
  • ADR and roadmap evidence refreshed: every code citation was re-checked against the merged code. The ADR's Decision section is byte-identical.
  • Flaky test fixed: test_ipv4_loopback_allowed was root-caused to a macOS accept-queue overflow with listen(1) and unaccepted connections, reproduced without pytest. It is fixed by draining connections and passed 40/40 runs in isolation.

Merge Danger

Door: two-way

Production code is unchanged. Reverting the merge commit restores the previous test suite and CI configuration.

Blast Radius: Tests and CI

  • CI fails loudly on lock drift: uv sync --locked fails if uv.lock is out of date with pyproject.toml. This is intended, but contributors must commit lockfile updates.
  • Network-dependent tests: any test that silently relied on network access now fails with BlockedNetworkError unless it is marked integration. No existing test was affected.
  • Strict markers: unregistered pytest markers are now errors.
  • Dependency floor: environments with smolagents older than 1.21.2 no longer satisfy the dependency constraint.
  • Home-directory workaround: tests/conftest.py temporarily patches Path.home() while the package is imported so the settings cache goes to a temp dir. The proper fix, a lazy cache dir, is follow-up agentic-internet-0m2.

Follow-ups:

  • agentic-internet-8xh: approve the ADR.
  • agentic-internet-0m2: lazy Settings cache dir.
  • agentic-internet-0za: RTM-1 child plan.

Add the RTM roadmap exec-plan and a proposed ADR keeping SmolAgents behind a project-owned reliability layer. Framework rewrite, multi-agent-first expansion, and status-quo patching are recorded as rejected alternatives.
Raise smolagents[mcp] floor to >=1.21.2 (the only verified version), install from the lockfile in CI with uv sync --locked, and pin every workflow action to a full commit SHA. uv.lock changes only the requirement specifier; no resolved versions change.
Add fake-only characterization tests pinning current InternetAgent, ResearchAgent, CLI, and MultiModelSerpAPISystem behavior, including known defects tagged with the RTM phase expected to change them. No source changes.
Add tests/conftest.py that disables dotenv loading and clears provider/MCP
env vars before importing agentic_internet, redirects the import-time
settings cache dir to a temp dir, blocks non-loopback network for tests
not marked integration (stdlib only), and offers an opt-in fresh_settings
fixture. Add a local stdio MCP echo server fixture and lifecycle tests
(start, list, call, shutdown, no leaked process) in the default lane.
Enable --strict-markers. No source or dependency changes.
# Conflicts:
#	docs/exec-plans/active/2026-12-04-evaluation-driven-agent-runtime.md
# Conflicts:
#	docs/exec-plans/active/2026-12-04-evaluation-driven-agent-runtime.md
Brings in PR #7 (stabilization baseline). Conflicts resolved: take upstream's setup-uv v10.3.3 with pinned uv 0.13.7; combine plan-index rows in upstream table format; keep upstream tests/test_internet_agent.py and move the RTM-0 characterization tests to tests/test_internet_agent_characterization.py. Characterization tests are re-pinned in a follow-up commit.
…line merge

Re-verify every code citation against merge commit 55566a7 (upstream PR #7). Point citations at agents/multi_model/{system,tools,context,model_manager}.py and current cli.py/internet_agent.py lines, mark InternetAgent max_steps/planning and tools=[] as fixed upstream, CI lockfile/uv pin and LiteLLM 1.108.3 as done, ModelManager duplication as partially addressed, and reword RTM-6 to build on the Plan 004 package split. ADR status stays proposed; decision and alternatives unchanged.
- InternetAgent: re-pin behavior fixed upstream in PR #7 (max_steps and
  planning_interval forwarded to ToolCallingAgent and CodeAgent; only
  tools=None loads defaults). Drop the tools=[] test duplicated by upstream
  tests/test_internet_agent.py; add a tools=None pin. Remaining RTM-5 defect
  pins (error strings, stateless chat, research findings) unchanged.
- Multi-model: patch fakes in agentic_internet.agents.multi_model.system
  where CodeAgent/ToolCallingAgent are now looked up, with guards proving the
  fakes apply. Timeout message (system.py:444) and shared
  current_task_context (system.py:306) defects still present; RTM-6 tags kept.
- Hermetic: check the load_dotenv no-op binding in multi_model.system (the
  shim no longer calls it). Fix racy IPv4 loopback test: listen(1) with
  never-accepted connections overflows the macOS accept queue and new SYNs
  get RST (ECONNRESET 54); accept each connection and use a backlog of 8.
The SHA-pinned trufflehog action defaults its 'version' input to 'latest', so the first PR #8 run pulled trufflehog:latest. Pin the scanner image to match the pinned action release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant