Skip to content

feat: add continuous-loop, branch-agent-identity, engine workflows#26

Open
blackboxprogramming wants to merge 1 commit intomainfrom
feat/agent-workflows
Open

feat: add continuous-loop, branch-agent-identity, engine workflows#26
blackboxprogramming wants to merge 1 commit intomainfrom
feat/agent-workflows

Conversation

@blackboxprogramming
Copy link
Owner

BlackRoad OS Agent Workflow Integration

Changes:

  • continuous-loop.yml: 24h+3s self-retriggering workflow on self-hosted Pi runners (gematria-do)
  • branch-agent-identity.yml: maps git branches to agent identities (main→OCTAVIA, develop→ALICE, feature/*→ARIA, hotfix/*→CIPHER)
  • continuous-engine.yml: autonomous orchestration engine
  • branch-agents.yml: agent identity configuration map

Cost: $0 (all self-hosted runners on Pi/DO cluster)

Auto-merge: enabled ✅

- continuous-loop.yml: 24h+3s self-retriggering workflow on self-hosted Pi runners
- branch-agent-identity.yml: maps git branches to agent identities
- continuous-engine.yml: autonomous orchestration engine
- branch-agents.yml: agent identity configuration map

Billable time: $0 (all self-hosted runners)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 23, 2026 22:52
@blackboxprogramming blackboxprogramming enabled auto-merge (squash) February 23, 2026 22:52
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 210ac238b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'continuous-engine.yml',
ref: 'master',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Dispatch workflow on an existing branch ref

The self-chaining step dispatches continuous-engine.yml with ref: 'master', but this repository only has main (no master), so createWorkflowDispatch returns a ref-not-found error and the perpetual loop job fails at the handoff point instead of reliably chaining the next run.

Useful? React with 👍 / 👎.

- name: Resolve agent identity from branch
id: resolve
run: |
BRANCH="${{ github.ref_name }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve source branch correctly for pull_request events

Using github.ref_name to identify the branch breaks branch-to-agent matching on pull_request triggers, because that value is the PR merge ref (e.g. 123/merge) rather than the contributor branch; as a result, most PRs will fall through to the default agent and get incorrect labels/comments.

Useful? React with 👍 / 👎.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Actions workflows intended to run continuously on self-hosted runners and to tag PRs based on branch→agent identity mappings.

Changes:

  • Introduces a 24h(+3s) self-retriggering workflow (continuous-loop.yml).
  • Adds a self-chaining “continuous engine” workflow with a 5-minute scheduled heartbeat (continuous-engine.yml).
  • Adds a workflow to map branches to agent identities and label/comment on PRs (branch-agent-identity.yml), plus a YAML config map (.github/agents/branch-agents.yml).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
.github/workflows/continuous-loop.yml Daily scheduled + self-dispatch loop intended to run continuously on self-hosted runners
.github/workflows/continuous-engine.yml Perpetual “engine” workflow with health check, work loop, and self-dispatch
.github/workflows/branch-agent-identity.yml Branch pattern → agent resolution + PR labeling/commenting
.github/agents/branch-agents.yml Static branch→agent configuration map (currently not consumed by code)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +63
case "$BRANCH" in
main|master)
AGENT="CECE"; EMOJI="💜"; COLOR="#9C27B0"; ROLE="Production Guardian" ;;
agent/octavia)
AGENT="OCTAVIA"; EMOJI="⚡"; COLOR="#FF9800"; ROLE="Architect & Infra" ;;
agent/alice)
AGENT="ALICE"; EMOJI="🚪"; COLOR="#4CAF50"; ROLE="Operator & Salesforce" ;;
agent/aria)
AGENT="ARIA"; EMOJI="🎵"; COLOR="#2196F3"; ROLE="Interface & Cloudflare" ;;
agent/lucidia)
AGENT="LUCIDIA"; EMOJI="🌀"; COLOR="#00BCD4"; ROLE="Dreamer & HuggingFace" ;;
agent/shellfish)
AGENT="SHELLFISH"; EMOJI="🐚"; COLOR="#FF5722"; ROLE="Hacker & Security" ;;
agent/gematria)
AGENT="GEMATRIA"; EMOJI="🔢"; COLOR="#607D8B"; ROLE="Railway & External" ;;
agent/olympia)
AGENT="OLYMPIA"; EMOJI="🏛️"; COLOR="#9E9E9E"; ROLE="KVM & Hardware" ;;
agent/cece)
AGENT="CECE"; EMOJI="💜"; COLOR="#9C27B0"; ROLE="Identity & Memory" ;;
agent/prism)
AGENT="PRISM"; EMOJI="🔮"; COLOR="#E91E63"; ROLE="Analytics & Patterns" ;;
agent/echo)
AGENT="ECHO"; EMOJI="📡"; COLOR="#673AB7"; ROLE="Memory & Recall" ;;
agent/cipher)
AGENT="CIPHER"; EMOJI="🔐"; COLOR="#212121"; ROLE="Security & Encryption" ;;
agent/codex)
AGENT="CODEX"; EMOJI="📖"; COLOR="#795548"; ROLE="Code & Documentation" ;;
develop|development)
AGENT="LUCIDIA"; EMOJI="🌀"; COLOR="#00BCD4"; ROLE="Integration Thinker" ;;
feat/*|feature/*)
AGENT="ALICE"; EMOJI="🚪"; COLOR="#4CAF50"; ROLE="Feature Executor" ;;
fix/*|bugfix/*|hotfix/*)
AGENT="OCTAVIA"; EMOJI="⚡"; COLOR="#FF9800"; ROLE="Bug Crusher" ;;
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

branch-agent-identity.yml’s branch→agent mapping conflicts with both the PR description and .github/agents/branch-agents.yml (e.g., main|master maps to CECE here, but main maps to OCTAVIA in the config/description). Please align the mappings (or generate them from a single source of truth) to avoid labeling PRs with the wrong agent.

Copilot uses AI. Check for mistakes.
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'continuous-engine.yml',
ref: 'master',
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding ref: 'master' means the engine will always dispatch the next run on the master branch (and will fail outright if master doesn’t exist). For a self-chaining workflow, dispatch on the current ref (context.ref / ${{ github.ref_name }}) or the repo’s default branch to avoid unexpected behavior.

Suggested change
ref: 'master',
ref: context.ref,

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +28
schedule:
- cron: '*/5 * * * *' # Heartbeat every 5 min (keeps alive if chain breaks)
workflow_dispatch:
inputs:
chain_count:
description: 'Chain iteration count'
required: false
default: '0'
type: string
mode:
description: 'Run mode'
required: false
default: 'perpetual'
type: choice
options: [perpetual, once, maintenance]

concurrency:
group: continuous-engine
cancel-in-progress: false # NEVER cancel - perpetual

Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With schedule: */5 * * * * and concurrency.cancel-in-progress: false, every 5-minute tick will queue a new run while the current run is active. Over a 6-hour run this can accumulate dozens of queued runs and may create a permanent backlog. Consider cancel-in-progress for the scheduled trigger, splitting heartbeat into a separate lightweight workflow, or removing the schedule if self-chaining is sufficient.

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +32
contents: write
actions: write
issues: write
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow grants contents: write and issues: write, but this file only appears to need actions: write for createWorkflowDispatch. Please reduce token permissions to the minimum required to limit blast radius on self-hosted runners.

Suggested change
contents: write
actions: write
issues: write
contents: read
actions: write

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +130
// Comment with agent identity
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## ${emoji} ${agent} — ${role}\n\n> This branch is owned by **${agent}**.\n> Identity: \`${role}\`\n> Branch pattern matched: \`${{ github.ref_name }}\`\n\n*BlackRoad Branch Agent Identity System*`
});
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow posts a new PR comment on every pull_request event you subscribe to (including synchronize), which can spam threads on active PRs. Consider commenting only on opened/ready_for_review, or updating an existing bot comment instead of creating a new one each time.

Suggested change
// Comment with agent identity
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## ${emoji} ${agent} — ${role}\n\n> This branch is owned by **${agent}**.\n> Identity: \`${role}\`\n> Branch pattern matched: \`${{ github.ref_name }}\`\n\n*BlackRoad Branch Agent Identity System*`
});
// Comment with agent identity (only on selected PR actions to avoid spam)
if (context.payload.action === 'opened' || context.payload.action === 'ready_for_review') {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## ${emoji} ${agent} — ${role}\n\n> This branch is owned by **${agent}**.\n> Identity: \`${role}\`\n> Branch pattern matched: \`${{ github.ref_name }}\`\n\n*BlackRoad Branch Agent Identity System*`
});
}

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +17
# Branch → Agent Identity Map
# Each branch is assigned an agent identity with capabilities and persona

version: "1.0"
updated: "2026-02-23"

assignments:
main:
agent: OCTAVIA
role: "Architect"
color: "\033[0;35m"
emoji: "🔴"
description: "Production-grade, stable, reviewed by architect"
capabilities: [deploy, monitor, review, approve]
auto_deploy: true
environments: [production]

Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This agent mapping file is currently not referenced anywhere in the repository (no workflow/script reads .github/agents/branch-agents.yml), so it can easily drift from the actual mapping logic. Either wire branch-agent-identity.yml to read from this config, or remove the file until it’s consumed.

Copilot uses AI. Check for mistakes.

concurrency:
group: continuous-loop
cancel-in-progress: false
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop duration is 24h+3s (sleep 86403), but the fallback cron triggers exactly every 24h at midnight. That guarantees an overlap each day where the scheduled run fires before the current run finishes; with concurrency.cancel-in-progress: false this will accumulate queued runs over time. Consider removing the cron, shortening the sleep, or setting cancel-in-progress: true for this workflow.

Suggested change
cancel-in-progress: false
cancel-in-progress: true

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +38
- name: Self-retrigger
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run continuous-loop.yml \
--repo ${{ github.repository }} \
--ref ${{ github.ref_name }} || true
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow dispatch in the “Self-retrigger” step requires actions: write permission for GITHUB_TOKEN in repos where the default token permission is read-only. Add an explicit permissions: { actions: write } (or broader if needed) at the workflow level to make this reliably work across repo settings.

Copilot uses AI. Check for mistakes.
run: |
gh workflow run continuous-loop.yml \
--repo ${{ github.repository }} \
--ref ${{ github.ref_name }} || true
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh workflow run ... || true will silently swallow failures to re-trigger (e.g., auth/permission issues), which can cause the loop to stop without any signal. Consider failing the job (or at least emitting an error and setting a non-zero exit unless in a deliberate “best-effort” mode) so breakage is visible.

Suggested change
--ref ${{ github.ref_name }} || true
--ref ${{ github.ref_name }}

Copilot uses AI. Check for mistakes.
# BLACKROAD CONTINUOUS ENGINE
# Self-chaining workflow that runs forever via perpetual re-trigger
# Pattern: runs 24h 3s loop → triggers itself → never stops
# Cost: $0 (uses GitHub free tier - 2000 min/month for public repos)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header comment claims “2000 min/month for public repos”, which is not accurate for GitHub Actions billing (public repos are not limited that way; limits apply to private repos depending on plan). Please correct or remove this to avoid misleading operators.

Suggested change
# Cost: $0 (uses GitHub free tier - 2000 min/month for public repos)
# Note: Uses GitHub Actions minutes; billing and limits depend on your GitHub plan (see GitHub Actions billing docs).

Copilot uses AI. Check for mistakes.
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.

2 participants