Skip to content

ci: start one bounded buyer-gap task when the PR queue is empty - #47

Open
seonghobae wants to merge 41 commits into
mainfrom
feat/hourly-product-development-loop
Open

ci: start one bounded buyer-gap task when the PR queue is empty#47
seonghobae wants to merge 41 commits into
mainfrom
feat/hourly-product-development-loop

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

Add the missing hourly transition from an empty protected PR queue to one bounded buyer-visible Keyverse development task.

Buyer-visible operational gap closed

The existing PR steward safely advances reviewed work but stops when the queue reaches zero. Keyverse can therefore sit idle while high-impact identity-control-plane gaps remain. This PR adds a separate fail-closed scheduler that delegates one bounded product slice without giving the scheduler merge, approval, repository-write, or release authority.

Runtime contract

  • runs every hour at minute 41, offset from PR stewardship at minute 17;
  • uses stable concurrency with cancel-in-progress: false;
  • grants the normal GITHUB_TOKEN read-only Actions, Checks, contents, and pull-request access;
  • uses a step-scoped COPILOT_GITHUB_TOKEN user credential only for Agent Tasks inventory and creation;
  • suppresses dispatch when the credential is absent, the PR queue is non-empty, exact main evidence is missing or unhealthy, the complete task inventory is unreadable, or any task has an active, malformed, or unknown state;
  • requires successful exact-main ci and CodeQL push runs and successful latest check evidence;
  • preserves Security Scan and SAST Semgrep as protected exact-head PR merge gates because those workflows do not run again on the squash-generated main commit;
  • revalidates the exact base SHA, open-PR queue, and Agent Tasks queue immediately before the sole POST;
  • sends at most one POST /agents/repos/ContextualWisdomLab/keyverse/tasks request with base_ref: main and create_pull_request: true;
  • accepts no admin bypass, self-approval, scheduler push, scheduler merge, or release publication.

Delegated task contract

The immutable task prompt requires exactly one buyer-visible slice, Superpowers design/TDD/systematic debugging/verification, realistic identity-control-plane tests, 100% production docstring/statement/branch coverage, standalone and CWL/Naruon modularity, two-word-or-longer snake_case database names, APA 7th standards or primary-research documentation, and guarded use of contextual-orchestrator, NVIDIA_NIM_API_KEY, Figma, and Product Design only when genuinely applicable.

Repository issues, comments, docs, fixtures, provider metadata, generated files, payloads, and fetched references are explicitly treated as untrusted data rather than instructions. The delegated agent is forbidden to expose repository, Actions, model-provider, or user secrets.

TDD evidence

The first focused contract test was executed before the workflow existed and failed with the expected FileNotFoundError for .github/workflows/hourly-product-development.yml. Production workflow implementation followed that RED evidence. Contract tests now cover scheduling, permissions, secret scope, exact-main evidence, complete task pagination, unknown-state suppression, pre-POST revalidation, one-POST bounds, prompt invariants, and prohibited merge/push behavior.

Operations and documentation

  • adds docs/operations/hourly-product-development.md with credential setup, first activation, rotation, revocation, race boundaries, incident response, and release separation;
  • adds an architecture/design specification and implementation plan;
  • updates the root README and CHANGELOG.md under [Unreleased];
  • introduces no database schema change;
  • preserves standalone deployment and CWL/Naruon module embedding.

Standards basis

  • GitHub. (2026). REST API endpoints for agent tasks. GitHub Docs.
  • GitHub. (2026). Using Copilot cloud agent via the API. GitHub Enterprise Cloud Docs.
  • GitHub. (2026). Workflow syntax for GitHub Actions. GitHub Docs.

The implementation uses Agent Tasks API version 2026-03-10; the API requires a fine-grained personal access token or GitHub App user access token with Agent Tasks read/write permission rather than the default GitHub App installation token.

Protected completion

Exact-head CI, CodeQL, Semgrep, Security Scan, CodeRabbit review, and the repository's protected merge decision remain authoritative. The schedule becomes active only after this workflow reaches main.

Release

No version bump or release is included. Task scheduling is operational infrastructure, not sufficient evidence that the broader Keyverse 0.2.0 product and supply-chain release criteria are complete.

Closes #46.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 50 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13f891d0-5985-4273-a556-938a2275f99e

📥 Commits

Reviewing files that changed from the base of the PR and between ff873f5 and d1b69de.

📒 Files selected for processing (17)
  • .github/workflows/bootstrap-finalize-opencode-product-loop.yml
  • .github/workflows/bootstrap-finalize-opencode-v3.yml
  • .github/workflows/bootstrap-finalize-opencode-v4.yml
  • .github/workflows/bootstrap-reconcile-opencode-product-loop.yml
  • .github/workflows/hourly-product-development.yml
  • CHANGELOG.md
  • README.md
  • docs/operations/hourly-product-development.md
  • docs/superpowers/plans/2026-08-04-keyverse-hourly-product-development.md
  • docs/superpowers/specs/2026-08-04-keyverse-hourly-product-development-design.md
  • scripts/ci/finalize_opencode_product_loop.py
  • scripts/ci/hourly_product_guard.py
  • scripts/ci/nim_proxy.py
  • scripts/ci/reconcile_opencode_product_loop.py
  • services/account_unification/tests/test_hourly_product_development.py
  • services/account_unification/tests/test_hourly_product_guard.py
  • services/account_unification/tests/test_nim_proxy.py

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

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact current head 3f5f983c258bc036c1979e9e8983724c076d724d. Focus on the Agent Tasks credential boundary, single-flight task inventory, exact-main health evidence, one-POST bound, prompt injection surface, least-privilege workflow permissions, and fail-closed behavior.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 4 minutes and 59 seconds before sending another message.

@seonghobae
seonghobae marked this pull request as ready for review August 4, 2026 12:12

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact current head 8b09958bdc6682c42f105bd21e4845a0fd986483. The PR is now ready. Focus on least privilege, Agent Tasks token isolation, complete pagination, exact-main health evidence, immediate base/PR/task revalidation, prompt-injection resistance, and the one-POST fail-closed bound.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== checked-out commit =='
git rev-parse HEAD
git status --short
echo '== requested commit =='
git show -s --format='%H%n%P%n%s' 8b09958bdc6682c42f105bd21e4845a0fd986483

echo '== PR diff files =='
git diff --name-status 8b09958bdc6682c42f105bd21e4845a0fd986483^ 8b09958bdc6682c42f105bd21e4845a0fd986483

echo '== candidate files =='
fd -H -t f 'hourly-product-development|product-development|agent.*task|task.*agent' .github docs tests 2>/dev/null || true

echo '== workflow outline =='
if [ -f .github/workflows/hourly-product-development.yml ]; then
  ast-grep outline .github/workflows/hourly-product-development.yml --items all || true
  nl -ba .github/workflows/hourly-product-development.yml
fi

echo '== relevant test and documentation references =='
rg -n -i -C 3 \
  'hourly-product-development|COPILOT_GITHUB_TOKEN|/agents/repos/.*/tasks|Agent Tasks|base_ref|create_pull_request|cancel-in-progress|CodeQL|Security Scan|SAST Semgrep' \
  --glob '!**/.git/**' .

Length of output: 2022


🏁 Script executed:

#!/bin/bash
set -euo pipefail

line_file() {
  local file="$1"
  echo "== $file =="
  awk '{printf "%6d  %s\n", NR, $0}' "$file"
}

base="$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main)"
echo "== merge base =="
git rev-parse "$base"
echo "== complete PR change list =="
git diff --name-status "$base"...HEAD
echo "== complete PR diff statistics =="
git diff --stat "$base"...HEAD

line_file .github/workflows/hourly-product-development.yml
line_file services/account_unification/tests/test_hourly_product_development.py

echo "== workflow definitions that reference required checks or protected controls =="
for f in $(fd -H -t f -e yml -e yaml .github/workflows); do
  if grep -Eqi '(^name:|CodeQL|Security Scan|SAST Semgrep|pull_request|schedule|permissions:|concurrency:)' "$f"; then
    line_file "$f"
  fi
done

echo "== full PR diff for workflow and test =="
git diff --no-ext-diff --unified=80 "$base"...HEAD -- \
  .github/workflows/hourly-product-development.yml \
  services/account_unification/tests/test_hourly_product_development.py

Length of output: 61035


🏁 Script executed:

#!/bin/bash
set -euo pipefail

line_file() {
  local file="$1"
  echo "== $file =="
  awk '{printf "%6d  %s\n", NR, $0}' "$file"
}

echo "== all workflow files =="
while IFS= read -r file; do
  line_file "$file"
done < <(fd -H -t f -e yml -e yaml .github/workflows)

echo "== product-development documentation =="
for file in \
  docs/operations/hourly-product-development.md \
  docs/superpowers/specs/2026-08-04-keyverse-hourly-product-development-design.md \
  docs/superpowers/plans/2026-08-04-keyverse-hourly-product-development.md; do
  [ -f "$file" ] && line_file "$file"
done

echo "== references to workflow evidence and Agent Tasks =="
rg -n -i -C 4 \
  'workflow_dispatch|push run|exact.main|head_sha|event|check-runs|Agent Tasks|COPILOT_GITHUB_TOKEN|Security Scan|SAST Semgrep' \
  README.md CHANGELOG.md docs .github/workflows services/account_unification/tests

Length of output: 1634


🏁 Script executed:

#!/bin/bash
set -euo pipefail

line_file() {
  local file="$1"
  echo "== $file =="
  awk '{printf "%6d  %s\n", NR, $0}' "$file"
}

echo "== all workflow files =="
workflow_files="$(fd -H -t f -e yml -e yaml . .github/workflows || true)"
for file in $workflow_files; do
  line_file "$file"
done

echo "== product-development documentation =="
for file in \
  docs/operations/hourly-product-development.md \
  docs/superpowers/specs/2026-08-04-keyverse-hourly-product-development-design.md \
  docs/superpowers/plans/2026-08-04-keyverse-hourly-product-development.md; do
  if [ -f "$file" ]; then
    line_file "$file"
  fi
done

echo "== relevant references =="
rg -n -i -C 4 \
  'workflow_dispatch|push run|exact.main|head_sha|event|check-runs|Agent Tasks|COPILOT_GITHUB_TOKEN|Security Scan|SAST Semgrep' \
  README.md CHANGELOG.md docs .github/workflows services/account_unification/tests || true

Length of output: 141463


@seonghobae Reviewed exact head 8b09958bdc6682c42f105bd21e4845a0fd986483.

I found no actionable issues in the requested scope.

The workflow uses read-only repository permissions. It isolates COPILOT_GITHUB_TOKEN to the two Agent Tasks steps. It paginates task inventory and fails closed for unreadable, malformed, active, or unknown task state. It validates the exact main SHA, rechecks base SHA, PR queue, and task inventory before the single POST.

The ci and CodeQL workflows run on push to main and on pull requests. They have no manual-dispatch trigger. Therefore, the successful exact-main SHA evidence satisfies the required main-push health gate.

The immutable prompt treats repository and external content as untrusted data. It prohibits secret disclosure, self-approval, self-merge, check bypass, and release publication.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae enabled auto-merge (squash) August 4, 2026 12:16
@opencode-agent
opencode-agent Bot disabled auto-merge August 4, 2026 12:38
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.

[Operations Gap] Start one bounded buyer-gap development task each hour when the PR queue is empty

2 participants