Skip to content

refactor(agent)!: slim the tablassert agent CLI surface - #60

Merged
SkyeAv merged 2 commits into
mainfrom
agent-optimizations
Jul 30, 2026
Merged

refactor(agent)!: slim the tablassert agent CLI surface#60
SkyeAv merged 2 commits into
mainfrom
agent-optimizations

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Why

tablassert agent accumulated knobs that were either unused or redundant, and its workspace lived in a standalone .tablassert-agent/ dir instead of the shared .tablassert/ parent. This slims the surface down to what actually drives behavior.

What (breaking)

  • Removed --qc-threshold/-qt. It was echoed into the run metrics but never gated any decision — accept/MAPPED is driven solely by --map-threshold coverage, so the flag implied an enforcement that didn't exist. (qc_pass_rate is still measured and recorded per record.)
  • Removed --executor/-e and the Docker sandbox. Model-written code now always runs on the in-process local executor, pinned in build_agent. A local-only flag would be dead weight, so the flag goes entirely.
  • Removed --no-fetch/-nf. The supervisor always fetches the PMC payload; the snapshot-replay branch is deleted.
  • --map-threshold default 0.80.25 — a more achievable mapping bar for real articles.
  • Workspace .tablassert-agent/.tablassert/agent/ — under the shared, already-auto-created and git-ignored .tablassert/ parent (utils.BASE).

Files

  • src/tablassert/cli.py, src/tablassert/agent.py — flag/param removal, default changes, fetch-branch collapse, executor_type pinned to local, qc_threshold dropped from the metrics dict.
  • tests/ — updated test_agent_cli.py + test_agent_docs.py; deleted the two test_supervisor_no_fetch_* tests (removed functionality); reworded a docstring. No dead imports remain (yaml/_column_cfg still used).
  • docs/agent.md — stripped the removed flags, renamed the workspace path, deleted the Docker-sandbox defense bullet, fixed the re-download prose.
  • .gitignore — dropped the now-redundant .tablassert-agent/ line.
  • CHANGELOG.md — Breaking Changes bullet under Unreleased.

Testing

  • uv run tablassert agent --help--map-threshold shows [default: 0.25], --state-dir shows [default: .tablassert/agent]; --qc-threshold, --executor, --no-fetch are gone.
  • Agent subset: uv sync --extra agent && uv run pytest -q tests/test_agent_*.py tests/test_cover_agent_propose.py132 passed.
  • Full suite (all extras) → 646 passed; pre-commit (ruff, ruff format, pyright, pytest) all green on the commit.
  • ruff check + ruff format --check clean on all edited files.

Migration notes

  • Passing --qc-threshold, --executor, or --no-fetch now errors as an unknown flag — remove them.
  • Existing .tablassert-agent/ workspaces are not migrated: re-run the agent or move the dir to .tablassert/agent/. Configs' source.local is absolute, so a moved workspace still needs source.local fixed (unchanged caveat).

Summary by CodeRabbit

  • Breaking Changes

    • Streamlined the tablassert agent CLI by removing QC, executor, and no-fetch options.
    • Agent execution now uses the local executor and always fetches PMC content.
    • Lowered the default map threshold from 0.8 to 0.25.
    • Changed the default workspace location to .tablassert/agent/.
  • Documentation

    • Updated agent usage, workspace, persistence, and pipeline integration guidance to reflect the new workflow.

Remove three knobs that were dead weight or redundant and fold the agent
workspace under the shared `.tablassert/` parent:

- Drop `--qc-threshold`/`-qt`: echoed into the run metrics but never gated any
  decision (accept/MAPPED is driven solely by `--map-threshold` coverage).
  `qc_pass_rate` is still recorded per record.
- Drop `--executor`/`-e` and its Docker sandbox option: model-written code now
  always runs on the in-process `local` executor (pinned in `build_agent`).
- Drop `--no-fetch`/`-nf`: the supervisor always fetches the PMC payload; the
  snapshot-replay branch and its two supervisor tests are removed.
- Lower the `--map-threshold` default from 0.8 to 0.25.
- Move the agent workspace default from `.tablassert-agent/` to
  `.tablassert/agent/` (already auto-created and git-ignored via `*.tablassert/`).

Docs, the docs-contract test, and the CHANGELOG are updated to match; no test
relies on the old default (all pass it explicitly).
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@SkyeAv, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 32798721-6ddd-480b-be5e-a08e658fe33a

📥 Commits

Reviewing files that changed from the base of the PR and between a299fb4 and f3dc7f4.

📒 Files selected for processing (1)
  • docs/agent.md
📝 Walkthrough

Walkthrough

The tablassert agent interface removes QC, executor, and no-fetch options. Agent execution is fixed to local, PMC data is always fetched, defaults use .tablassert/agent/ and a 0.25 map threshold, and documentation and tests are updated.

Changes

Agent CLI Surface Simplification

Layer / File(s) Summary
Supervisor execution contract
src/tablassert/agent.py, tests/test_agent_fetch.py, tests/test_agent_supervisor.py
Agent construction now fixes the local executor; supervisor parameters and metrics remove QC, executor, and fetch controls; PMC payloads are always fetched and missing supplementary tables produce skipped records.
CLI documentation and validation
src/tablassert/cli.py, docs/agent.md, CHANGELOG.md, .gitignore, tests/test_agent_cli.py, tests/test_agent_docs.py
CLI defaults, workspace documentation, changelog notes, ignore rules, and parsing/forwarding assertions reflect the streamlined command surface.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • SkyeAv/Tablassert#56: Introduced the agent functionality that this PR refactors across supervisor behavior, CLI wiring, documentation, and tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main breaking refactor: slimming the tablassert agent CLI surface.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent-optimizations

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/tablassert/agent.py (2)

2143-2154: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve aggregate metrics across checkpoint/resume.

all_metrics is recreated empty on every invocation, while terminal records are skipped. On a resume with no new work, this assignment resets token, step, and tool-call totals to zero; a partial resume also discards prior totals. Seed these counters from persisted metrics or aggregate per-record metrics before overwriting state.metrics.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tablassert/agent.py` around lines 2143 - 2154, Update the metrics
aggregation before assigning state.metrics to preserve persisted totals across
checkpoint/resume. When all_metrics is empty or records are skipped, seed
total_tokens, total_steps, total_tool_calls, failed_tool_calls,
wrong_tool_calls, and redundant_tool_calls from existing state.metrics or
per-record aggregates, while retaining newly computed values for fresh work.

1623-1632: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Clarify that executor_type: "local" is not a sandbox. Model-generated code still runs against the host process; the minimal import allowlist only narrows imports and does not provide OS-level isolation. Add an explicit warning in docs/agent.md, or move untrusted execution into an isolated process/container.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tablassert/agent.py` around lines 1623 - 1632, The Agent configuration’s
executor_type "local" runs model-generated code in the host process and is not a
sandbox; document this explicitly in docs/agent.md near the executor
configuration, including that additional_authorized_imports only restricts
imports and provides no OS-level isolation. No direct code change is required in
src/tablassert/agent.py unless untrusted execution is instead moved to an
isolated process or container.
🧹 Nitpick comments (2)
docs/agent.md (1)

126-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the non-migration of existing workspaces. The new default does not automatically discover .tablassert-agent/ checkpoints.

  • docs/agent.md#L126-L148: explain that users must pass the old --state-dir or migrate the directory before resume.
  • CHANGELOG.md#L8-L8: add the same breaking-change caveat.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/agent.md` around lines 126 - 148, Document that existing
.tablassert-agent/ workspaces are not automatically discovered under the new
default: in docs/agent.md lines 126-148, instruct users to pass the previous
--state-dir or migrate the workspace before resuming; add the same
breaking-change caveat to CHANGELOG.md line 8.
tests/test_agent_cli.py (1)

97-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Protect the removed-flag contract with negative tests.

  • tests/test_agent_cli.py#L97-L108: assert the new default state directory and parser rejection of --executor, --no-fetch, and --qc-threshold.
  • tests/test_agent_docs.py#L37-L38: assert those removed flags are absent from docs/agent.md.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_agent_cli.py` around lines 97 - 108, The test_agent_cli.py agent
flag-parsing coverage must also assert the new default state directory and that
parsing rejects --executor, --no-fetch, and --qc-threshold. In
tests/test_agent_docs.py lines 37-38, add assertions that docs/agent.md omits
all three removed flags; update only these specified test sites.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/agent.md`:
- Line 130: Update the fenced workspace-tree code block in the documentation
around the `.tablassert/agent/` listing to specify an appropriate language,
preferably text, after the opening fence so it satisfies markdownlint MD040.

---

Outside diff comments:
In `@src/tablassert/agent.py`:
- Around line 2143-2154: Update the metrics aggregation before assigning
state.metrics to preserve persisted totals across checkpoint/resume. When
all_metrics is empty or records are skipped, seed total_tokens, total_steps,
total_tool_calls, failed_tool_calls, wrong_tool_calls, and redundant_tool_calls
from existing state.metrics or per-record aggregates, while retaining newly
computed values for fresh work.
- Around line 1623-1632: The Agent configuration’s executor_type "local" runs
model-generated code in the host process and is not a sandbox; document this
explicitly in docs/agent.md near the executor configuration, including that
additional_authorized_imports only restricts imports and provides no OS-level
isolation. No direct code change is required in src/tablassert/agent.py unless
untrusted execution is instead moved to an isolated process or container.

---

Nitpick comments:
In `@docs/agent.md`:
- Around line 126-148: Document that existing .tablassert-agent/ workspaces are
not automatically discovered under the new default: in docs/agent.md lines
126-148, instruct users to pass the previous --state-dir or migrate the
workspace before resuming; add the same breaking-change caveat to CHANGELOG.md
line 8.

In `@tests/test_agent_cli.py`:
- Around line 97-108: The test_agent_cli.py agent flag-parsing coverage must
also assert the new default state directory and that parsing rejects --executor,
--no-fetch, and --qc-threshold. In tests/test_agent_docs.py lines 37-38, add
assertions that docs/agent.md omits all three removed flags; update only these
specified test sites.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 05429a04-18b8-43bd-bb35-5cf167611179

📥 Commits

Reviewing files that changed from the base of the PR and between d3d194c and a299fb4.

📒 Files selected for processing (9)
  • .gitignore
  • CHANGELOG.md
  • docs/agent.md
  • src/tablassert/agent.py
  • src/tablassert/cli.py
  • tests/test_agent_cli.py
  • tests/test_agent_docs.py
  • tests/test_agent_fetch.py
  • tests/test_agent_supervisor.py
💤 Files with no reviewable changes (2)
  • .gitignore
  • tests/test_agent_supervisor.py

Comment thread docs/agent.md Outdated
Addresses CodeRabbit's one actionable suggestion on PR #60: the directory-listing fence had no language, tripping markdownlint MD040.
@SkyeAv
SkyeAv merged commit ce19b39 into main Jul 30, 2026
5 checks passed
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