mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
* feat(tests): e2e scenario 2 — the PM merge chain through the PR gate
Shared arcs extracted (arcs.py: canonical-company seeding + dev/qa/doc
segments); scenario 2 seeds a root->cell->dev hierarchy mid-flight, rides
the child through the scenario-1 arc into the cell branch (real squash
via the fake GitHub), then submit_up -> claim_gate_review/pr_pass ->
dispatcher re-claim (mirrored) -> PM complete merging cell->root. This is
the exact PM->reviewer->PM turn sequence the wave-1 turn cut shortens —
the BEFORE-net. Learned seams scripted: commit-subject validator (>=20
chars), reviewer learning-note gate, pr_pass clears ownership by design.
* feat(runtime): PR-gate turn cut — assembled parents auto-submit to the reviewer
When every child of an assembled parent is terminal, the closure
dispatcher now runs the real submit_up/submit_root through the internal
API as the owning PM (_try_auto_submit) instead of spawning the PM for
that turn — the submit's substance is deterministic gate code. Any gate
refusal falls back to the classic PM closure spawn; pr_fail routing and
the PM's final merge turn are unchanged; umbrellas never auto-submit.
ROBOCO_PR_GATE_AUTO_SUBMIT_ENABLED default-on; task.auto_submitted audit
row per cut. Proven by e2e scenario 2b (real API, real gates, real git)
against scenario 2 as the before-net.
* feat(notes): structured note sections carry a written_at trace stamp
Sections are overwrite-in-place, so without a stamp there was no way to
reconstruct WHEN a dev/qa/doc/reviewer note landed (CEO reMarkable item:
trace TIMESTAMPS). apply_structured_note stamps ISO written_at beside
the model fields; the panel notes tab renders it next to each card
title (pre-stamp rows render nothing). Progress updates, commits, and
journal entries already carried timestamps — this was the one gap.
* feat(tasks): server-side task search — title, details, and id prefix
The task list's search box only matched titles client-side, and the
trimmed summary payload deliberately carries no description — so
keyword/details/id search was impossible in the browser by design.
GET /tasks/summary gains q (ILIKE over title+description, id-prefix
match, composed with team/status and the view-permission scoping);
the panel debounces the box into the summary fetch and drops the
title-only client filter that would have hidden description matches.
* feat(wave-1): trace timestamps, real task search, Secretary task edits
- apply_structured_note stamps written_at per section; the panel notes
tab shows it (the one trace surface without a timestamp).
- GET /tasks/summary?q= searches title+description+id-prefix server-side
(summaries carry no description by design); panel debounces into the
fetch and drops the title-only client filter.
- Secretary control_task gains a CEO-gated edit action over the content
allowlist, and GET /secretary/tasks?q= resolves task names to ids for
the chat. PM-side expansion deferred per the CEO's 'not that much'.
* fix(workspace): dep-update probe scrubs the inherited venv pin
Under uv run the orchestrator's process tree carries VIRTUAL_ENV, and a
uv-based dep_update_command in the throwaway probe clone would target
that venv instead of the clone's — the same hazard _uv_subprocess_env
already guards on the install path.
* build: private per-repo uv cache — isolate from machine-wide uvx servers
Root cause of the recurring rich/pip/bandit rot, with evidence: uv cache
clean timed out on the ~/.cache/uv lock ('is another uv process
running?') — three uvx mcp-server-fetch processes (Claude Code fetch MCP,
one alive since Wednesday) share that cache and race repo syncs on it;
poisoned entries then survive venv rebuilds because rm -rf .venv never
touches the cache, and every re-link reproduces the breakage. UV_CACHE_DIR
now pins <repo>/.uv-cache (gitignored). The earlier UV_NO_SYNC
serialization stays as defense-in-depth but was not the whole story.
* feat(tests): e2e scenario 3 — pr_fail revision loop + root→CEO chain
3a: reviewer pr_fail with a concrete issue -> needs_revision ->
i_will_plan re-entry (full plan gates) -> real fix lands on the cell
branch (the unchanged-PR hard gate refuses resubmit until it does) ->
clean second pass -> merge. 3b: submit_root -> gate -> Main PM complete
escalates the root to the CEO -> the REAL approve-and-merge endpoint
squash-merges to the origin's master. Harness gains the tasks router, a
seeded CEO identity, origin_commit, and a fake GitHub whose head.sha is
recomputed live (real-GitHub semantics the unchanged gate reads). Seeds
now encode the real shape: delivery roots are team=main_pm and
planning-typed.
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
228 lines
7.9 KiB
Python
228 lines
7.9 KiB
Python
"""Scenario 3: the pr_fail revision loop and the root → CEO chain.
|
|
|
|
3a: the reviewer REJECTS the assembled cell PR (`pr_fail` with concrete
|
|
issues) → needs_revision; the PM resumes, re-submits, and the second gate
|
|
pass rides through to the merge — the loop the live fleet burned tokens on
|
|
when any link mis-routed.
|
|
|
|
3b: after the cell lands on the root branch, the Main PM submits the root
|
|
(root → master PR), the reviewer gate-passes it, the Main PM's `complete`
|
|
escalates the root parent to the CEO, and the REAL CEO endpoint
|
|
(`POST /api/tasks/{id}/approve-and-merge`) squash-merges to master —
|
|
`hello.txt` ends up on the origin's master, the whole company loop closed
|
|
with no LLM anywhere.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from http import HTTPStatus
|
|
from typing import TYPE_CHECKING
|
|
|
|
import httpx
|
|
from tests.e2e_smoke.arcs import (
|
|
dispatcher_assign,
|
|
origin_commit,
|
|
origin_file,
|
|
reviewer_gate_pass_arc,
|
|
seed_company,
|
|
seed_hierarchy,
|
|
seed_project,
|
|
task_state,
|
|
)
|
|
from tests.e2e_smoke.harness import ScriptedAgent, expect_ok
|
|
from tests.e2e_smoke.test_pm_merge_chain import _land_child, _pm_merges_cell
|
|
|
|
if TYPE_CHECKING:
|
|
from tests.e2e_smoke.harness import E2EStack
|
|
|
|
|
|
def test_pr_fail_revision_loop(e2e_stack: E2EStack) -> None:
|
|
stack = e2e_stack
|
|
company = seed_company(stack)
|
|
project_id, project_slug = seed_project(stack, company)
|
|
h = seed_hierarchy(stack, company, project_id)
|
|
pm = _land_child(stack, company, project_slug, h)
|
|
cell_id = str(h["cell_id"])
|
|
|
|
expect_ok(
|
|
pm.flow(
|
|
"submit_up",
|
|
task_id=cell_id,
|
|
notes=(
|
|
"All children terminal and merged into the cell branch; "
|
|
"assembling the cell PR for the in-path review gate."
|
|
),
|
|
),
|
|
"pm submit_up (first)",
|
|
)
|
|
|
|
reviewer = ScriptedAgent(
|
|
stack, company.pr_reviewer_id, "pr-reviewer-1", "pr_reviewer"
|
|
)
|
|
expect_ok(
|
|
reviewer.flow("claim_gate_review", task_id=cell_id),
|
|
"reviewer claim_gate_review (first)",
|
|
)
|
|
expect_ok(
|
|
reviewer.do(
|
|
"note",
|
|
scope="learning",
|
|
task_id=cell_id,
|
|
text=(
|
|
"Gate review learning: the assembled diff is missing a "
|
|
"trailing newline convention the root branch enforces — "
|
|
"sending back with a concrete fix."
|
|
),
|
|
),
|
|
"reviewer learning note (fail pass)",
|
|
)
|
|
expect_ok(
|
|
reviewer.flow(
|
|
"pr_fail",
|
|
task_id=cell_id,
|
|
issues=[
|
|
"hello.txt should end with exactly one trailing newline "
|
|
"per the root branch's file conventions."
|
|
],
|
|
),
|
|
"reviewer pr_fail",
|
|
)
|
|
assert task_state(stack, h["cell_id"])["status"] == "needs_revision"
|
|
|
|
# The revision dispatcher routes the assembled task back to its PM;
|
|
# mirror that hand-back, then the PM resumes and re-submits.
|
|
dispatcher_assign(stack, h["cell_id"], company.cell_pm_id)
|
|
expect_ok(
|
|
pm.flow(
|
|
"i_will_plan",
|
|
task_id=cell_id,
|
|
plan=(
|
|
"Address the gate's concrete issue and re-submit the cell PR "
|
|
"for a clean pass through the in-path review gate."
|
|
),
|
|
approach=(
|
|
"Take the reviewer's single concrete finding — hello.txt must "
|
|
"end with exactly one trailing newline per the root branch's "
|
|
"file conventions — verify the file on the cell branch already "
|
|
"satisfies it, re-check the assembled diff against the root "
|
|
"branch for any other convention drift, and then re-run "
|
|
"submit_up so the gate reviews a corrected, freshly assembled "
|
|
"cell PR."
|
|
),
|
|
sub_tasks=[
|
|
{
|
|
"title": "Verify the newline convention",
|
|
"description": (
|
|
"Confirm hello.txt on the cell branch ends with exactly "
|
|
"one trailing newline as the reviewer's finding requires."
|
|
),
|
|
},
|
|
{
|
|
"title": "Re-submit the assembled PR",
|
|
"description": (
|
|
"Run submit_up again so the freshness and integrity "
|
|
"checks re-assemble the cell PR for a clean gate pass."
|
|
),
|
|
},
|
|
],
|
|
),
|
|
"pm i_will_plan after pr_fail",
|
|
)
|
|
# The unchanged-PR hard gate (0.14.0) refuses a resubmit until new work
|
|
# advances the cell branch HEAD — land the dev's fix, then resubmit.
|
|
origin_commit(
|
|
stack,
|
|
h["cell_branch"],
|
|
"hello.txt",
|
|
"Hello from the merge chain, with tidy newline conventions!\n",
|
|
f"[{str(h['child_id'])[:8]}] fix: normalize hello.txt trailing newline",
|
|
)
|
|
expect_ok(
|
|
pm.flow(
|
|
"submit_up",
|
|
task_id=cell_id,
|
|
notes=(
|
|
"Revision addressed: file conventions verified against the "
|
|
"root branch; re-assembling the cell PR for the gate."
|
|
),
|
|
),
|
|
"pm submit_up (resubmit)",
|
|
)
|
|
assert task_state(stack, h["cell_id"])["status"] == "awaiting_pr_review"
|
|
|
|
reviewer_gate_pass_arc(stack, company, h["cell_id"])
|
|
_pm_merges_cell(stack, company, pm, h)
|
|
|
|
|
|
def test_root_chain_lands_on_master_via_ceo(e2e_stack: E2EStack) -> None:
|
|
stack = e2e_stack
|
|
company = seed_company(stack)
|
|
project_id, project_slug = seed_project(stack, company)
|
|
h = seed_hierarchy(stack, company, project_id)
|
|
|
|
# Cell lands on the root branch exactly as scenario 2 proved.
|
|
pm = _land_child(stack, company, project_slug, h)
|
|
expect_ok(
|
|
pm.flow(
|
|
"submit_up",
|
|
task_id=str(h["cell_id"]),
|
|
notes=(
|
|
"All children terminal and merged into the cell branch; "
|
|
"assembling the cell PR for the in-path review gate."
|
|
),
|
|
),
|
|
"pm submit_up",
|
|
)
|
|
reviewer_gate_pass_arc(stack, company, h["cell_id"])
|
|
_pm_merges_cell(stack, company, pm, h)
|
|
|
|
# --- Main PM: submit the root → master PR, gate, complete → escalate ----
|
|
main_pm = ScriptedAgent(stack, company.main_pm_id, "main-pm", "main_pm")
|
|
root_id = str(h["root_id"])
|
|
expect_ok(
|
|
main_pm.flow(
|
|
"submit_root",
|
|
task_id=root_id,
|
|
notes=(
|
|
"Every cell task is terminal and assembled on the root "
|
|
"branch; opening the root PR against master for the gate."
|
|
),
|
|
),
|
|
"main_pm submit_root",
|
|
)
|
|
root = task_state(stack, h["root_id"])
|
|
assert root["status"] == "awaiting_pr_review", root
|
|
assert root["pr_number"], root
|
|
|
|
reviewer_gate_pass_arc(stack, company, h["root_id"])
|
|
dispatcher_assign(stack, h["root_id"], company.main_pm_id)
|
|
expect_ok(
|
|
main_pm.flow(
|
|
"complete",
|
|
task_id=root_id,
|
|
notes=(
|
|
"Gate passed on the assembled root PR; approving the root "
|
|
"parent and escalating to the CEO for the merge decision."
|
|
),
|
|
),
|
|
"main_pm complete root",
|
|
)
|
|
assert task_state(stack, h["root_id"])["status"] == "awaiting_ceo_approval"
|
|
|
|
# --- the human gate: the REAL CEO endpoint merges to master --------------
|
|
resp = httpx.post(
|
|
f"{stack.base_url}/api/tasks/{root_id}/approve-and-merge",
|
|
headers={
|
|
"X-Agent-ID": str(company.ceo_id),
|
|
"X-Agent-Role": "ceo",
|
|
},
|
|
timeout=60,
|
|
)
|
|
assert resp.status_code == HTTPStatus.OK, (
|
|
f"approve-and-merge: {resp.status_code} {resp.text[:1500]}"
|
|
)
|
|
assert task_state(stack, h["root_id"])["status"] == "completed"
|
|
assert origin_file(stack, "master", "hello.txt"), (
|
|
"the CEO merge did not land hello.txt on master"
|
|
)
|