Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/upstreaming-worker.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions .github/workflows/upstreaming-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ pipeline. The trusted pre-agent step wrote the immutable task to
branch in `./fork`. The task's
`plan` field says what to do; `reason_ids` and `context` say why. For repair and
revision tasks, read every entry in `context.reason_evidence` before researching
or editing. Treat its concrete review feedback and rejected-change descriptions
as required repair constraints, then verify them against repository history.
or editing. Treat every concrete review comment, PR conversation comment and
rejected-change description in every reason evidence record as a required
repair constraint, then verify each one against repository history. A repair is
incomplete if even one requested change is omitted.

Only process the compiler-supplied `work_queue_assignment`. It has exactly
one Claim; use its `handle` as `claim_handle` on every safe output and on
Expand All @@ -290,7 +292,11 @@ call: `{"path": "upstreaming-out"}` (the native handler names the artifact
`append` (new commits on top of `expected_head`), `rewrite` (a series on
top of `base_sha`, only if `allowed_operations` contains it) or `none`.
`changed_files` lists every path your series changes relative to
`expected_head` (for `rewrite`, relative to it as well).
`expected_head` (for `rewrite`, relative to it as well). For a repair or
revision task, `reason_ids` must include every task `reason_ids` entry. In
`diagnosis`, include a checklist with one item per review or CI constraint,
the exact change that addresses it, and how you verified that change. Never
claim `no_change` while required review feedback remains unresolved.
`patch_digest` is the sha256 of `patches.mbox`, or null.
- `patches.mbox`: for `append`, `git -C fork format-patch --stdout <expected_head>`;
for `rewrite`, `git -C fork format-patch --stdout <base_sha>`. Omit it
Expand Down
1 change: 1 addition & 0 deletions SESSIONLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
- Updated the workflow trigger contract to assert that contribution-state-only pushes refresh only the public website and do not wake pipeline control workflows.
- Updated acceptance validation so state-only pushes may trigger exactly `website.yml`, preserving the rule that they never wake pipeline control or model workflows.
- Addressed PR #4989 review feedback by moving the status-page generator into `upstreaming/`, invoking it through `uv run`, and adding focused rendering coverage.
- Fixed review and CI reconciliation so pending human feedback survives head changes, every repair carries and acknowledges all feedback evidence, `fix_needed` cannot be overwritten before dispatch, and any executed build or test failure returns handoff to automated development repair.
12 changes: 11 additions & 1 deletion upstreaming/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,17 @@ represented only by an opaque ID. Controller observation polls the recorded
same-fork PR for current-head reviews and inline comments from configured
authority actor IDs. New feedback is persisted once as `human_relay` evidence,
records processed review/comment IDs, bumps the revision and automatically
requests `development_repair`.
requests `development_repair`. Pending feedback evidence survives branch-head
changes and is attached to every repair until exact-head CI is green. A repair
proposal must acknowledge every required evidence record. Observation does not
replace `fix_needed` before the controller can allocate that repair.

Exact-head CI is green only when every executed build or test job succeeds, in
addition to the target riscv64 job and wheel contract. Failures confined to
package publishing, upload, or release-request validation remain non-blocking in
the intentionally credentialless destination organization. A build or test
failure discovered after handoff automatically returns the contribution to
revisioned development repair.

Previously merged implementation:

Expand Down
10 changes: 10 additions & 0 deletions upstreaming/ci_evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

SUCCESS = "success"
NOT_EXECUTED = frozenset({"skipped", "neutral", "cancelled", "action_required", "stale", None})
# Disposable forks intentionally lack package publishing credentials and OIDC
# trust. Those jobs may fail naturally and do not invalidate build/test CI.
CREDENTIALLESS_JOB_MARKERS = ("publish", "upload_pypi", "upload to pypi", "validate-release-request")


@dataclass
Expand Down Expand Up @@ -59,6 +62,13 @@ def evaluate(*, runs: list[dict], jobs_by_run: dict[int, list[dict]], head_sha:
return v
all_jobs = [j for r in relevant for j in jobs_by_run.get(r["id"], [])]
pending = [j for j in all_jobs if j.get("status") != "completed"]
blocking_failures = [
j for j in all_jobs
if job_executed(j) and j.get("conclusion") != SUCCESS
and not any(marker in j.get("name", "").lower() for marker in CREDENTIALLESS_JOB_MARKERS)
]
for j in blocking_failures:
v.problems.append(f"job {j['name']!r} failed ({j.get('conclusion')})")
# Wheel success means the wheel was built on the native runner label: a
# job only matches when its name matches and it ran on that label.
for pat in required_job_patterns:
Expand Down
8 changes: 5 additions & 3 deletions upstreaming/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,11 @@ def tick(*, contributions: dict[str, dict], operations: dict[str, dict], consume
continue
slots -= 1
reason_ids = []
if kind in ("development_repair", "upstream_revision") and c.get("last_ci_evidence_id"):
reason_ids = [c["last_ci_evidence_id"]]
elif c.get("dossier_evidence_id"):
if kind in ("development_repair", "upstream_revision"):
reason_ids = list(dict.fromkeys(
(c.get("pending_feedback_evidence_ids") or [])
+ ([c["last_ci_evidence_id"]] if c.get("last_ci_evidence_id") else [])))
if not reason_ids and c.get("dossier_evidence_id"):
reason_ids = [c["dossier_evidence_id"]]
work = {
"type": "submit_work",
Expand Down
4 changes: 4 additions & 0 deletions upstreaming/fork_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def check_proposal(proposal: dict, record: dict, task: dict, *, allow_no_change:
raise PublishRejected("proposal/task/record contribution mismatch")
if proposal["expected_revision"] != task["revision"] or proposal["expected_head"] != task["expected_head"]:
raise PublishRejected("proposal does not answer the admitted task (revision/head)")
if task.get("task") in ("development_repair", "upstream_revision"):
missing_reasons = set(task.get("reason_ids") or []) - set(proposal.get("reason_ids") or [])
if missing_reasons:
raise PublishRejected(f"repair proposal did not acknowledge required evidence: {sorted(missing_reasons)}")
fork = (record.get("fork") or {}).get("name") or ""
if not fork.startswith(FORK_ORG + "/") or task["fork"] != fork:
raise PublishRejected("task fork is not the recorded contribution fork")
Expand Down
30 changes: 28 additions & 2 deletions upstreaming/observe_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,23 @@ def observe(api: collect.Api, *, contributions: dict[str, dict], operations: dic
+ feedback["comment_ids"])[-512:],
processed_pr_conversation_comment_ids=(
(cur.get("processed_pr_conversation_comment_ids") or [])
+ feedback["conversation_comment_ids"])[-512:], updated_at=now)
+ feedback["conversation_comment_ids"])[-512:],
pending_feedback_evidence_ids=list(dict.fromkeys(
(cur.get("pending_feedback_evidence_ids") or []) + [eid]))[-64:],
updated_at=now)
schemas.validate("contribution", cur)
obs.staged.extend([("evidence", ev), ("contributions", cur),
("events", lifecycle._event(before, cur, "development_review_feedback",
"observation", eid, now, True))])
entry["review_feedback"] = eid
obs.report.append(entry)
continue
# A requested repair must reach the controller before another CI poll
# can reclassify the same unchanged head as waiting for a human.
if cur["activity"] == "fix_needed":
entry["note"] = "repair remains required"
obs.report.append(entry)
continue
upstream_facing = cur.get("upstream_pr") is not None
repo_for_ci = cur["upstream"]["full_name"] if upstream_facing else fork
snap = collect.ci_snapshot(api, repo_for_ci, head["head"])
Expand Down Expand Up @@ -153,10 +162,27 @@ def observe(api: collect.Api, *, contributions: dict[str, dict], operations: dic
if verdict.state == "passed" and cur.get("last_ci_evidence_id") != eid:
cur = dict(cur, last_ci_evidence_id=eid, updated_at=now)
obs.staged.append(("contributions", cur))
if verdict.state == "failed" and cur["phase"] == "handoff":
before = cur
moved = lifecycle.transition(cur, "development", cause_type="observation",
cause_id=eid, now=now)
status = lifecycle.observe_status(moved.record, activity="fix_needed", now=now)
cur = dict(status.record, last_ci_evidence_id=eid,
pending_human_action=None, updated_at=now)
schemas.validate("contribution", cur)
obs.staged.append(("contributions", cur))
if moved.event:
obs.staged.append(("events", moved.event))
if status.event:
obs.staged.append(("events", status.event))
entry["activity"] = "fix_needed"
entry["returned_to_development"] = True
obs.report.append(entry)
continue
if verdict.state == "passed" and cur["phase"] == "development" and not cur.get("debug_commits"):
before = cur
cur = dict(cur, phase="handoff", activity="waiting_human", active_work=None,
clean_head_sha=head["head"],
clean_head_sha=head["head"], pending_feedback_evidence_ids=[],
handoff_request={"command_id": f"observation-{eid}", "head": head["head"],
"revision": cur["revision"]},
pending_human_action={"kind": "approve_handoff", "requested_at": now,
Expand Down
13 changes: 13 additions & 0 deletions upstreaming/reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,19 @@ def numeric(value):
out.report["dispatch_recovery"] = rep
out.report["dispatch_relaunch"] = relaunch

# 1d. Carry durable review constraints across head changes. Older records
# predate pending_feedback_evidence_ids, so recover their already-ingested
# human relay evidence before selecting another repair.
for key, c in list(contributions.items()):
feedback_ids = sorted(
e["evidence_id"] for e in snap.evidence.values()
if e.get("kind") == "human_relay" and e.get("contribution_id") == c["contribution_id"])
if feedback_ids and "pending_feedback_evidence_ids" not in c \
and c["phase"] in {"development", "handoff", "upstream_review"}:
c = dict(c, pending_feedback_evidence_ids=feedback_ids[-64:])
contributions[key] = c
out.staged.append(("contributions", c))

# 2. Live branch and CI observation.
if observe:
contracts = {e["evidence_id"]: e for e in snap.evidence.values() if e.get("kind") == "target_contract"}
Expand Down
4 changes: 4 additions & 0 deletions upstreaming/schemas/contribution.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@
"type": "array", "maxItems": 512,
"items": {"type": "integer", "minimum": 1}
},
"pending_feedback_evidence_ids": {
"type": "array", "maxItems": 64,
"items": {"type": "string", "maxLength": 200}
},
"active_work": {
"anyOf": [
{
Expand Down
6 changes: 6 additions & 0 deletions upstreaming/tests/test_fork_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def proposal(self, **over):
p.update(over)
return p

def test_repair_must_acknowledge_every_reason_evidence_record(self):
self.task["task"] = "development_repair"
with self.assertRaisesRegex(fork_publish.PublishRejected, "did not acknowledge"):
fork_publish.check_proposal(self.proposal(reason_ids=[]), self.record, self.task)
fork_publish.check_proposal(self.proposal(reason_ids=["ci-1"]), self.record, self.task)

def fork_head(self):
return git(self.fork_bare, "rev-parse", "refs/heads/riscv64")

Expand Down
18 changes: 18 additions & 0 deletions upstreaming/tests/test_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def test_other_head_and_approval(self):
self.assertEqual(self.ev([run(1, sha=SHA_B)], {}).state, "missing")
self.assertEqual(self.ev([run(1, conclusion="action_required")], {}).state, "access_wait")

def test_any_executed_test_failure_blocks_green_but_publish_failure_does_not(self):
jobs = {1: [job(1, "wheels riscv64"), job(2, "tests (3.12)", conclusion="failure")]}
verdict = self.ev([run(1)], jobs)
self.assertEqual(verdict.state, "failed")
self.assertIn("tests (3.12)", " ".join(verdict.problems))
publish_only = {1: [job(1, "wheels riscv64"),
job(2, "validate-release-request", conclusion="failure")]}
self.assertEqual(self.ev([run(1)], publish_only).state, "passed")

def test_rerun_uses_latest_attempt(self):
runs = [run(1, attempt=1), run(1, attempt=2)]
v = self.ev(runs, {1: [job(1, "wheels riscv64")]})
Expand Down Expand Up @@ -328,6 +337,15 @@ def test_repair_selected_with_capacity_only(self):
self.assertEqual(eff["effect_contract"]["ref"], "riscv64")
self.assertEqual(eff["expected_head"], SHA_A)

def test_repair_carries_pending_review_and_latest_ci_evidence(self):
rec = contribution(activity="fix_needed")
rec["pending_feedback_evidence_ids"] = ["review-1", "review-2"]
rec["last_ci_evidence_id"] = "ci-3"
res = controller.tick(contributions={"a": rec}, operations={}, consumed={}, projects={},
policy=policy(), inputs=controller.Inputs(
now=T, pressure=capacity.Pressure(ok=True)))
self.assertEqual(res.requested_effects[0]["reason_ids"], ["review-1", "review-2", "ci-3"])

def test_uncertain_operation_holds_work(self):
rec = contribution(activity="fix_needed")
op = recovery.plan(contribution_id=rec["contribution_id"], revision=0, kind="branch_update",
Expand Down