Build order for the approved design in architecture.md. Each phase ends with the verification listed for it, and nothing moves to the next phase while the current one fails. The task-level implementation plan, including the owner's execution rules (ask before each paid API run and each outward-facing GitHub step), is plans/2026-09-24-agentic-workflows.md.
Branch: feat/agentic-workflows. Status: all phases done; verification logs are in
decisions.md. The branch hasn't been merged to main; that is the owner's call.
ruff check app tests scriptsis clean..venv/bin/pytest -q: all existing tests pass (70 at baseline51be21f). They run in stub mode, so no API key or database is needed.cd web && npx tsc -b && npx vite buildpasses wheneverweb/changed.- No new automated tests in this round, by the owner's decision (D12). Anything new is checked with the manual steps below.
- Branch
feat/agentic-workflowscreated. - The API lockdown and CLAUDE.md are committed (
51be21f). originnow points athttps://github.com/Badri-Rajendran/CodeSage.git.
This proves the five open items in decisions.md against the live API. The spike code lives in the session scratchpad, not in the repo.
Verify:
- A script prints pass/fail for each item, plus the real cost.
- The Postgres checks use a throwaway pgvector container on a free port, because 5432 is taken by another project on the owner's machine.
- If an item fails, stop and present the fallback options to the owner before continuing.
Changes:
- Engine dependencies in
pyproject.toml/requirements.txt:langchain>=1.4.2,<1.5langchain-anthropic>=1.7.4,<2anthropic>=0.120,<1langgraph>=1.2.11,<1.3pyyaml
[server]extra: the FastAPI, DB and MCP stack, pluslanggraph-checkpoint-postgres,psycopg[binary]andpsycopg-pool.- Makefile, Dockerfile, CI and CONTRIBUTING are updated to install
.[server,dev]. app/llm/client.pyis re-checked against the upgraded SDK.
Verify:
- The standing checks pass.
pip install .(engine only) into a clean venv importsapp.actionwithout any server package.
Changes:
app/diff/: parser,is_commentable,filter.app/workspace/: tools, path confinement, output caps,clone_at, andrun_testswith a scrubbed environment and process-group timeout.
Verify:
- Parse real diffs from this repo's history (
git diff 27bf9e6 6a4f2b1) and spot-check the hunk ranges againstgit diff -U0. - Run each tool against this repo, including a path that escapes the root (must be
refused) and a
run_testscommand that sleeps past its timeout (must be killed).
Changes:
app/llm/models.pyapp/llm/budget.pyPRICESupdate- middleware (budget, trace, call limits)
- reviewer agents
- decision-based reflection and
apply_decisions - the Opus 5 judge
- the
reviseedge - graph modes (
action,local,report) - stub path
- rewritten prompts
Verify:
- The standing checks pass (stub mode).
- A manual run on a CodeSage checkout with a planted
os.system(input())diff:- the findings have the correct
reviewer,pathandline - the traces show real tool calls
- the total cost is ≤ $0.50
- the findings have the correct
- The same run with
budget_usd: 0.02reportsbudget_limitedand still returns structured findings. - A low-quality planted review is judged below 0.6 and gets exactly one
reviseround.
Outstanding: the live revise round hasn't been run. The owner skipped that paid run in
Phase 4. It's covered by code review and the stub-mode graph, and can be exercised by setting
gate: {threshold: 0.99} in a test repo's .codesage.yml. The other checks are covered by the
Phase 4 budget run and the Phase 5 paid runs (see decisions.md).
Changes:
app/action/:resolveandreviewcommands, rules, config, the local reproduction entry point.action.ymlapp/publish/github.py: review, inline comments, check run, markdown, job summary.GitHubClientadditions.- README usage section with an example workflow and
.codesage.yml.
Verify on a private test repo owned by the owner, using @feat/agentic-workflows:
- A PR with a planted bug gets a review whose inline comments are on the right lines,
a failing
CodeSagecheck run, and a job summary with the cost. - A clean PR gets a passing check.
- A draft PR is skipped until it's marked ready.
- A
/codesage reviewcomment from the owner triggers a review; the same comment from a non-collaborator doesn't. - The
codesage:reviewlabel triggers a review and is then removed. - The undocumented items listed in decisions.md are resolved and the docs updated: what happens to a comment on a line outside the diff, the permission needed to remove the label, and setup-python's current major version.
Changes:
migrations/0002_agentic.sql,scripts/migrate.pyand the model update.- Checkpointer lifecycle.
- Clone workspace for PR mode.
interrupt()gate andPOST /reviews/{id}/decision(replacing/approve).publishwith the idempotency marker.- Startup reconciliation, SSE and broker fixes.
- Console updates.
- MCP in
reportmode.
Verify on a local stack with a throwaway Postgres on a free port:
- A PR review that trips the gate reaches
awaiting_approval; after an API restart it is still awaiting. - Approving posts to the PR and stores
github_review_url. A second resume doesn't post twice. - Rejecting posts nothing and leaves the status
rejected. - A passing review is posted automatically.
- A diff-mode review completes without posting.
- Review Detail shows the traces, judge dimensions and cost.
- A row forced to
runningbecomesfailedon restart. - SSE for a random id returns 404; SSE for a finished review returns its final state and closes.
Changes:
- Delete
deploy/and remove every reference to it (list in design/03). - Update the README: the Action as the main usage, the local console as the companion, and the repo links.
- Update CLAUDE.md for the new architecture and commands.
- Refresh
docs/workflow.svg/.png(boxes 6–7 and the event chain). - Mark these docs' status as implemented.
Verify:
grep -rniE "deploy/|digitalocean|badrinarayanan/CodeSage" --exclude-dir=.git .returns nothing, except history in the docs.- The standing checks pass.
- Eval harness: a labelled dataset with expected findings, recall/precision, a
fixed judge, repeats, results stored in
eval_runs. Today's harness is kept runnable inreportmode but not improved. - New automated tests: mocked-LLM tests for the agent loop and budget, DB-backed tests for persistence and resume, SSE tests, and Action tests with recorded event payloads.
- Robustness: typed retry policies, per-reviewer failure isolation, large-diff chunking, prompt-injection hardening.
- Local RAG hardening: one embedder per index, HNSW, surfaced failures, ingest from a git URL.
- Hosted deployment (removed in Phase 7).