You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The permanently-revoked legacy-application-server FK-placeholder row (and any
revoked agent) was leaking into the /admin/agents operator panel because
_load_agents() ran select(Agent) with no revoked_at filter. Add the same
Agent.revoked_at.is_(None) filter every other agent query in the codebase
(main.py / shell.py / pipeline.py) already uses. Display-only fix β the legacy
Agent row stays in the DB as the FK default owner.
What changed
Task 1 β Filter revoked agents out of _load_agents (commit 8c85c8ba)
src/phaze/routers/admin_agents.py: changed
select(Agent) β select(Agent).where(Agent.revoked_at.is_(None)).
This single query change covers BOTH render paths (page() full-page +
HX-Request partial, and table_partial() /_table poll) since both call
_load_agents.
Updated the _load_agents docstring and the module docstring so they no
longer claim revoked agents "land last" in this panel (they no longer
appear); documented the shared revoked_at IS NULL convention. Left
classify / sort_key revoked handling in agent_liveness.py untouched
(still reachable for callers elsewhere; noted as effectively unreachable via
this panel). No DELETE/UPDATE against the Agent row anywhere.
Added test_revoked_agent_absent: asserts RevokedBox and
aria-label="Status: revoked" are absent from BOTH /admin/agents/_table
and /admin/agents, while the non-revoked control AliveBox is present
(proves the filter drops only revoked rows, not the whole table). Uses the
smoke fixture's explicitly-revoked RevokedBox (id revoked-agent,
revoked_at=now) β NOT the conftest legacy row, which is seeded WITHOUT
revoked_at and is therefore a NEVER agent in the test DB.
Renamed test_status_pills_render_all_5_states β
test_status_pills_render_4_visible_states; removed the "REVOKED" in body
assertion; kept the bg-gray-100 dark:bg-gray-800 (NEVER) assertion.
test_sort_order: removed "revoked" from the pos dict and the final
chained assertion (now alive < stale < dead < never); updated docstring.
Updated the module docstring bullets to reflect the 4 visible states and
that revoked agents are filtered out.
uv run mypy src/phaze/routers/admin_agents.py β Success, no issues.
uv run ruff check on both files β All checks passed.
uv run pytest tests/agents/routers/test_admin_agents.py -q β 18 passed
(against the ephemeral test Postgres on port 5433 via just test-db; the
suite requires the DB fixture β an initial run against the default 5432 dev DB
errored with OSError connection-refused, which is an infra/env issue, not a
test failure).
Pre-commit hooks ran on both commits β all hooks Passed (ruff, ruff-format,
bandit, mypy, etc.).
Notes
Worktree base was corrected: HEAD started at c559ab74 (release bump); the
plan commit is dc8fbda6. Hard-reset to dc8fbda6 per the branch-check
protocol before starting.
No new dependencies. No schema/migration changes. Legacy Agent row untouched
in the DB β display-only suppression.