Skip to content

Drop artifacts (Archive) from console tab collection - #69

Merged
erinepshovel-code merged 6 commits into
mainfrom
claude/hopeful-einstein-QvYK4
May 26, 2026
Merged

erinepshovel-code merged 6 commits into
mainfrom
claude/hopeful-einstein-QvYK4

Conversation

@erinepshovel-code

@erinepshovel-code erinepshovel-code commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rebased onto current main. The original transcripts/subagents fixes and the new tests/test_a0_package.py already landed on main via the auto-merged PR #70, so this PR is now scoped to the remaining unique change:

  • python/routes/__init__.pyartifacts is the standalone "Archive" page (routed at /archive via the top nav), like transcripts (/transcripts). It has empty sections and no custom renderer, so aggregating it in collect_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 + live collect_ui_meta): zero MISSING tabs, zero orphan renderers.
  • Test isolation (a0/state.py, a0/router.py, tests/test_a0_package.py) — honour A0_STATE_PATH / A0_LOG_DIR env vars so the package tests write state/logs to a temp dir instead of polluting the repo working tree.

Notes

https://claude.ai/code/session_018fWZmwRbdzw3WAofM8bARB

Copilot AI review requested due to automatic review settings May 25, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sdk usage so importing a0.adapters doesn’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_registry import usage test, removed a stale persistence test file, and added an a0 package/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 thread tests/test_a0_package.py Outdated
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e1083df.

  • a0/state.py now reads A0_STATE_PATH from the environment at import time, falling back to the repo-relative default.
  • a0/router.py does the same with A0_LOG_DIR.
  • test_handle_round_trips_in_process monkeypatches both a0.state.STATE_PATH and a0.router.LOG_DIR to paths under tmp_path.
  • test_a0_cli_smoke passes A0_STATE_PATH and A0_LOG_DIR env vars (pointing to tmp_path) into the subprocess environment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 05c7c3c. The fix has three parts:

  • a0/state.py: STATE_PATH now reads from A0_STATE_PATH env var if set (os.environ.get("A0_STATE_PATH", default))
  • a0/router.py: LOG_DIR likewise reads from A0_LOG_DIR env var
  • tests/test_a0_package.py:
    • test_handle_round_trips_in_process uses tmp_path+monkeypatch to redirect both attributes before calling handle()
    • test_a0_cli_smoke passes A0_STATE_PATH/A0_LOG_DIR pointing to tmp_path in the subprocess env

Comment thread tests/test_a0_package.py Fixed
claude and others added 2 commits May 25, 2026 09:22
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
erinepshovel-code force-pushed the claude/hopeful-einstein-QvYK4 branch from e1083df to f32ebaa Compare May 25, 2026 09:22
Copilot AI review requested due to automatic review settings May 25, 2026 09:22
@erinepshovel-code erinepshovel-code changed the title Fix import/console-tab bugs in a0 and add package run tests Drop artifacts (Archive) from console tab collection May 25, 2026
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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>
Copilot AI review requested due to automatic review settings May 26, 2026 01:54
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
erinepshovel-code marked this pull request as ready for review May 26, 2026 01:59
@erinepshovel-code
erinepshovel-code merged commit b5d9de9 into main May 26, 2026
6 of 7 checks passed
Copilot stopped work on behalf of erinepshovel-code due to an error May 26, 2026 01:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.

Comment thread a0/state.py

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 thread a0/router.py
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
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.

4 participants