Drop artifacts (Archive) from console tab collection - #69
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two import/UI-metadata issues that caused a0 (and the console tab UI) to break in certain environments, and adds a pytest smoke/regression suite to ensure the a0 package imports and the CLI runs end-to-end.
Changes:
- Guarded
claude_agent_sdkusage so importinga0.adaptersdoesn’t crash when the SDK is not installed. - Prevented
python.routes.transcripts(a standalone page) from being aggregated as a console tab. - Updated/added tests: fixed an
energy_registryimport usage test, removed a stale persistence test file, and added ana0package/CLI smoke test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/test_inference_modes_usage.py |
Fixes the import used by the cache breakdown round-trip test to match the current energy_registry API shape. |
tests/test_energy_registry_persistence.py |
Removes a stale test suite targeting an EnergyRegistry API that no longer exists. |
tests/test_a0_package.py |
Adds package-wide import smoke tests plus in-process and CLI end-to-end smoke coverage. |
python/routes/__init__.py |
Excludes transcripts from collect_ui_meta() so it doesn’t render as a broken/placeholder console tab. |
a0/adapters/subagents.py |
Makes subagent definitions importable without claude_agent_sdk by providing a lightweight stand-in AgentDefinition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+48
to
+79
| def test_handle_round_trips_in_process(): | ||
| from a0.contract import A0Request, normalize_hmmm | ||
| from a0.router import handle | ||
|
|
||
| req = A0Request( | ||
| task_id="unit-1", | ||
| input={"text": "hello", "files": [], "metadata": {}}, | ||
| tools_allowed=["none"], | ||
| mode="analyze", | ||
| hmmm=normalize_hmmm(["hmm"]), | ||
| ) | ||
| resp = handle(req) | ||
| assert resp.task_id == "unit-1" | ||
| assert resp.result is not None | ||
|
|
||
|
|
||
| def test_a0_cli_smoke(): | ||
| payload = { | ||
| "task_id": "smoke1", | ||
| "input": {"text": "hello a0", "files": [], "metadata": {}}, | ||
| "tools_allowed": ["none"], | ||
| "mode": "analyze", | ||
| "hmmm": ["hmm"], | ||
| } | ||
| proc = subprocess.run( | ||
| [sys.executable, "-m", "a0.a0"], | ||
| input=json.dumps(payload).encode("utf-8"), | ||
| stdout=subprocess.PIPE, | ||
| check=True, | ||
| ) | ||
| out = json.loads(proc.stdout.decode("utf-8")) | ||
| assert out["task_id"] == "smoke1" |
Contributor
There was a problem hiding this comment.
Fixed in e1083df.
a0/state.pynow readsA0_STATE_PATHfrom the environment at import time, falling back to the repo-relative default.a0/router.pydoes the same withA0_LOG_DIR.test_handle_round_trips_in_processmonkeypatches botha0.state.STATE_PATHanda0.router.LOG_DIRto paths undertmp_path.test_a0_cli_smokepassesA0_STATE_PATHandA0_LOG_DIRenv vars (pointing totmp_path) into the subprocess environment.
Contributor
There was a problem hiding this comment.
Done in commit 05c7c3c. The fix has three parts:
a0/state.py:STATE_PATHnow reads fromA0_STATE_PATHenv var if set (os.environ.get("A0_STATE_PATH", default))a0/router.py:LOG_DIRlikewise reads fromA0_LOG_DIRenv vartests/test_a0_package.py:test_handle_round_trips_in_processusestmp_path+monkeypatchto redirect both attributes before callinghandle()test_a0_cli_smokepassesA0_STATE_PATH/A0_LOG_DIRpointing totmp_pathin the subprocess env
artifacts is the standalone Archive page (/archive via top nav), like transcripts (/transcripts): empty sections and no custom renderer. Being aggregated by collect_ui_meta() made the console render an unrenderable placeholder tab, which the console-tab regression guard flags as MISSING. Remove it from the console tab list alongside transcripts. https://claude.ai/code/session_018fWZmwRbdzw3WAofM8bARB
- a0/state.py: honour A0_STATE_PATH env var (falls back to repo-relative default) - a0/router.py: honour A0_LOG_DIR env var (falls back to repo-relative default) - tests: monkeypatch STATE_PATH/LOG_DIR for in-process test; pass env vars to subprocess for CLI smoke test Agent-Logs-Url: https://github.com/The-Interdependency/a0/sessions/b2c98b43-5506-4beb-89ec-3fd7d592d9bf Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
erinepshovel-code
force-pushed
the
claude/hopeful-einstein-QvYK4
branch
from
May 25, 2026 09:22
e1083df to
f32ebaa
Compare
Agent-Logs-Url: https://github.com/The-Interdependency/a0/sessions/94326d62-b306-4a4d-9a85-87814abd6533 Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
Contract fixes surfaced by running the full contract suite against a live DB + server: - spawn_executor_resolve_provider_rejects_empty: _resolve_provider is async, but the contract called it without await, so it never raised and the check silently passed nothing. Make the test async/awaited. - gating_allowlist_entries_are_real_routes: removed the stale 'focus.py POST /subagent' allowlist entry (route no longer exists). Module-doctrine adherence: - Add the required '# DOC role:' field to all route files (route/api/ service/config per the naming convention); add missing description/ tier to transcripts.py and tier to _admin_gate.py. - Add python/tests/contracts/module_doctrine.py and three CONTRACTS (routes_doc_blocks_complete, routes_files_annotated, routes_routers_registered) so DOC-block completeness, annotation presence, and router registration are enforced going forward. Full suite: 34 contracts pass (0 fail/0 error), 168 pytest pass. https://claude.ai/code/session_018fWZmwRbdzw3WAofM8bARB
…rt' and 'import from'' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Agent-Logs-Url: https://github.com/The-Interdependency/a0/sessions/31865166-742c-485c-b8bf-633d4317e838 Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
erinepshovel-code
marked this pull request as ready for review
May 26, 2026 01:59
Copilot stopped work on behalf of
erinepshovel-code due to an error
May 26, 2026 01:59
|
|
||
| STATE_PATH = Path(__file__).resolve().parent / "state" / "a0_state.json" | ||
| _DEFAULT_STATE_PATH = Path(__file__).resolve().parent / "state" / "a0_state.json" | ||
| STATE_PATH = Path(os.environ.get("A0_STATE_PATH", _DEFAULT_STATE_PATH)) |
Comment on lines
+16
to
18
| LOG_DIR = Path(os.environ.get("A0_LOG_DIR", _DEFAULT_LOG_DIR)) | ||
|
|
||
|
|
Comment on lines
+1
to
+12
| # 56:12 0:0 0:0 | ||
| # DOC module: tests.contracts.module_doctrine | ||
| # DOC label: Module doctrine adherence | ||
| # DOC description: Enforces the a0p module doctrine for python/routes/*.py: | ||
| # every route file carries a complete # DOC block (module, label, | ||
| # description, tier, role — each exactly once) with role drawn from the | ||
| # allowed set, opens/closes with the # N:M annotation, and — when it | ||
| # defines a module-level APIRouter — is registered in ALL_ROUTERS. | ||
| from __future__ import annotations | ||
|
|
||
| import re | ||
| import pathlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased onto current
main. The original transcripts/subagents fixes and the newtests/test_a0_package.pyalready landed onmainvia the auto-merged PR #70, so this PR is now scoped to the remaining unique change:python/routes/__init__.py—artifactsis the standalone "Archive" page (routed at/archivevia the top nav), liketranscripts(/transcripts). It has emptysectionsand no custom renderer, so aggregating it incollect_ui_meta()made the console render an unrenderable placeholder tab. Removed it from the console-tab collection. Verified by replicating the console-tab guard's exact logic (registry parse + livecollect_ui_meta): zero MISSING tabs, zero orphan renderers.a0/state.py,a0/router.py,tests/test_a0_package.py) — honourA0_STATE_PATH/A0_LOG_DIRenv vars so the package tests write state/logs to a temp dir instead of polluting the repo working tree.Notes
require_interdependent_core_ready()aborts startup because the publishedinterdependent-lib0.1.0 is metadata-only / not importable). That is an environment/dependency issue independent of this change; the tab-check logic itself passes.https://claude.ai/code/session_018fWZmwRbdzw3WAofM8bARB