Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Contextual Orchestrator Hourly Review Repair

on:
schedule:
- cron: "07 * * * *"

permissions:
contents: read

concurrency:
group: contextual-orchestrator-hourly-review-repair
cancel-in-progress: false

jobs:
dispatch-central-review-loop:
name: Dispatch protected central review loop
permissions:
contents: read
id-token: write
uses: ContextualWisdomLab/.github/.github/workflows/pr-review-fix-scheduler.yml@main
with:
target_repository: ContextualWisdomLab/contextual-orchestrator
base_branch: main
max_prs: "1"
max_dispatches: "1"
retry_hours: "1"
resolve_unreviewed_conflicts: true
autofix_workflow: pr-review-autofix.yml
secrets:
PR_REVIEW_MERGE_TOKEN: ${{ secrets.PR_REVIEW_MERGE_TOKEN }}
OPENCODE_APPROVE_TOKEN: ${{ secrets.OPENCODE_APPROVE_TOKEN }}
24 changes: 24 additions & 0 deletions docs/doctoring/contextual-orchestrator-hourly-review-caller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contextual Orchestrator hourly review caller

The repository owns one hourly trigger at minute `07`. It calls the central
protected PR review scheduler with `max_prs=1` and `max_dispatches=1`, so each
run has a bounded mutation scope and the next hour advances the loop.

The central scheduler validates the live PR head, dispatches the existing
OpenCode review agent, and selects the contextual-orchestrator gateway after
central PR #1170 and target PR #790 are available on their protected default
branches. This caller forwards only the two established scheduler secrets by
name, does not inherit the caller secret set, and does not reference
`COPILOT_GITHUB_TOKEN`.

`cancel-in-progress: false` is deliberate: a long-running model review must
finish and publish exact-head evidence rather than being discarded by the next
hourly tick. The caller is tested by
`tests/test_hourly_review_scheduler_contract.py`.

## Evidence boundary

At authoring time, central PR #1170 was open at exact head
`4684f6e212ba40d12e5217f0f52ee1e90c796ed8` and target PR #790 was pinned at
`0071751782ae535721e71785c3037989d2d27b77`. These are integration
prerequisites, not evidence that the caller has already run in production.
46 changes: 46 additions & 0 deletions docs/planning/adrs/0028-hourly-review-loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ADR 0028: Schedule the Protected Hourly Review Loop

- Status: Accepted
- Date: 2026-08-21
- Decision owners: contextual-orchestrator maintainers

## Decision

Run one repository caller at minute 07 of every hour. The caller invokes the
central `.github` `pr-review-fix-scheduler.yml` reusable workflow for exactly
one eligible PR or buyer-visible product-gap iteration, with one dispatch and a
one-hour redispatch window. It passes the target repository and `main` base
explicitly, forwards only `PR_REVIEW_MERGE_TOKEN` and
`OPENCODE_APPROVE_TOKEN`, and never uses `secrets: inherit` or
`COPILOT_GITHUB_TOKEN`.

The caller does not cancel an in-flight run. A long OpenCode, Noema, or Strix
review therefore survives the next hourly tick. The central scheduler remains
the authority for current-head validation, review-agent identity, Checks,
protected merge, and the contextual-orchestrator gateway introduced by central
PR #1170 and target PR #790.

## Consequences

- An empty PR queue still produces a bounded product-gap iteration through the
central scheduler's existing fallback contract.
- The repository remains independently runnable; the caller is only an
orchestration connector.
- The reusable workflow must be present on central `main` before the scheduled
caller can dispatch successfully.

## Customer next action

After this PR, central PR #1170, and target PR #790 are merged through their
protected paths, enable Actions for this repository. The first scheduled run
will inspect one current PR at `07` past the next hour. Use the normal
protected scheduler path for subsequent runs; this caller intentionally has no
manual branch-selection entry point.

## References (APA 7)

GitHub. (n.d.). *Events that trigger workflows*. Retrieved August 21, 2026,
from https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows

GitHub. (n.d.). *Reusing workflows*. Retrieved August 21, 2026, from
https://docs.github.com/en/actions/sharing-automations/reusing-workflows
35 changes: 35 additions & 0 deletions tests/test_hourly_review_scheduler_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Contract tests for the repository's one-hour central review caller."""

from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
WORKFLOW = ROOT / ".github/workflows/contextual-orchestrator-hourly-review-repair.yml"


def test_hourly_caller_uses_central_scheduler_and_target_repository() -> None:
"""Keep the hourly job on the protected central path."""
source = WORKFLOW.read_text(encoding="utf-8")
assert 'cron: "07 * * * *"' in source
assert " workflow_dispatch:" not in source
assert (
"uses: ContextualWisdomLab/.github/.github/workflows/"
"pr-review-fix-scheduler.yml@main"
) in source
assert "target_repository: ContextualWisdomLab/contextual-orchestrator" in source
assert 'base_branch: main' in source
assert 'max_prs: "1"' in source
assert 'max_dispatches: "1"' in source
assert 'retry_hours: "1"' in source
assert "resolve_unreviewed_conflicts: true" in source
assert "secrets: inherit" not in source
assert "PR_REVIEW_MERGE_TOKEN: ${{ secrets.PR_REVIEW_MERGE_TOKEN }}" in source
assert "OPENCODE_APPROVE_TOKEN: ${{ secrets.OPENCODE_APPROVE_TOKEN }}" in source
assert "id-token: write" in source
assert "COPILOT_GITHUB_TOKEN" not in source


def test_hourly_caller_does_not_cancel_an_in_flight_review() -> None:
"""Protect long-running review work from the next hourly tick."""
source = WORKFLOW.read_text(encoding="utf-8")
assert "cancel-in-progress: false" in source
Loading