Skip to content

feat(repo-architect): harden closed-loop execution with verifiable delegation and evidence-based PR reconciliation#65

Merged
Steake merged 8 commits intomainfrom
copilot/extend-issue-to-execution-loop
Mar 16, 2026
Merged

feat(repo-architect): harden closed-loop execution with verifiable delegation and evidence-based PR reconciliation#65
Steake merged 8 commits intomainfrom
copilot/extend-issue-to-execution-loop

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Description

Extends repo_architect from a stateless issue synthesiser into a four-lane continuous loop without replacing the issue-first governance model, and hardens the loop so delegation and reconciliation are auditable with machine-readable proof rather than optimistic inference.

Planning lane

  • run_issue_cycle loads .agent/work_state.json before planning and suppresses gaps whose fingerprints are already actively delegated
  • when all gaps are filtered by active fingerprints, it now returns an empty selection instead of falling back to the unfiltered list
  • newly created or updated issues are ingested back into work state after synthesis

Execution lane (--mode execution)

  • select_ready_issue() is deterministic and testable: eligible labels (arch-gap + copilot-task + needs-implementation) → blocking factual lifecycle exclusion (including ready-for-validation) → fingerprint/issue-number dedupe → per-lane concurrency guard → MAX_CONCURRENT_DELEGATED cap → priority sort (critical > high > medium > low)
  • _list_github_issues_by_labels() now filters out pull requests returned by the GitHub /issues endpoint so only real issues can be delegated
  • delegate_to_copilot() records factual delegation outcomes:
    • delegation-requested
    • delegation-confirmed
    • delegation-failed
    • delegation-unconfirmed
  • issue assignment is the sole execution triggerdelegation_mechanism is "assignment"
  • any linkage/audit comment is posted before assignment so it is included in the issue context Copilot receives at assignment time
  • that pre-assignment comment is audit-only and does not participate in delegation confirmation
  • delegation confirmation is based exclusively on the assignment API response and current assignee state; label changes alone are not proof of execution
  • post-assignment issue comments do not affect Copilot intake
  • top-level delegation_events[] are persisted in work state with timestamp, mechanism, target issue, and outcome

Reconciliation lane (--mode reconcile)

  • replaces naive #issue_number matching with ordered evidence linkage:
    1. fingerprint marker in PR body
    2. explicit repo-architect-linkage block in PR body
    3. branch naming convention tied to issue/fingerprint
    4. closing keyword / linked reference
    5. fallback #issue_number mention
  • reconcile_pr_state() records:
    • pr_match_method
    • pr_match_confidence (exact / strong / weak)
    • pr_match_evidence
    • ambiguous candidate matches
  • stronger prior PR matches are not overwritten by weaker evidence
  • PR state classification remains factual: merged, closed_unmerged, draft, open, stale

Memory lane / schema updates

  • durable .agent/work_state.json remains the memory substrate and now includes proof fields for delegation and PR matching:
    • delegation_mechanism
    • delegation_requested_at
    • delegation_confirmed_at
    • delegation_confirmation_evidence
    • delegation_comment_url
    • delegation_comment_id
    • delegation_assignment_evidence
    • pr_match_method
    • pr_match_confidence
    • pr_match_evidence
    • lifecycle_fact_state
    • lifecycle_inferred_state
  • factual state remains separate from inferred planning interpretation
  • persisted items are now schema-tolerant via _normalize_work_item_dict(), which drops unknown keys and fills defaults for missing required fields
  • module-level _WORK_ITEM_FIELDS and _WORK_ITEM_REQUIRED_DEFAULTS avoid repeated reflection overhead during normalization

Lifecycle semantics

Lifecycle labels now represent observed facts:

  • ready-for-delegation
  • delegation-requested
  • in-progress
  • pr-open
  • pr-draft
  • merged
  • closed-unmerged
  • stale
  • blocked-by-dependency
  • superseded-by-issue
  • superseded-by-pr
  • failed-delegation

Corrected prior assumptions:

  • closed-unmerged is not automatically mapped to superseded
  • stale is not automatically mapped to blocked-by-dependency

Workflows

  • repo-architect.yml remains the planning-oriented workflow and no longer advertises execution/reconcile dispatch modes that it does not run
  • repo-architect-execution.yml is the dedicated execution schedule and now has pull-requests: read
  • repo-architect-reconcile.yml is the dedicated reconciliation schedule with pull-requests: read
  • all three workflows now persist .agent/work_state.json across runs via versioned cache keys (repo-architect-work-state-v1-*)
  • scheduling and concurrency separation remain intact

Documentation

  • docs/repo_architect/OPERATOR_GUIDE.md was updated to match the implemented contract:
    • assignment is the sole Copilot trigger
    • the linkage comment is posted before assignment and is audit-only
    • post-assignment issue comments do not affect Copilot
    • reconciliation uses ordered evidence, not just #issue_number
    • lifecycle semantics are factual rather than interpretive
    • the main workflow dispatch docs now point execution/reconcile users to the dedicated workflows
    • the visible test count and merge-surface narrative now match the current branch state

Tests

  • expanded hermetic unittest coverage for:
    • delegation requested / confirmed / failed / unconfirmed flows
    • assignment-only confirmation behavior
    • comment-before-assignment ordering
    • confirmation even when the audit comment fails
    • reconciliation by fingerprint marker, linkage block, branch convention, and fallback issue-number reference
    • ambiguous/no-match reconciliation behavior
    • factual lifecycle transitions
    • schema-tolerant work-state ingestion
    • PR filtering from _list_github_issues_by_labels()
    • gap filtering when all fingerprints are already active
    • ready-for-validation blocking delegation
  • total repo-architect regression suite now: 251 hermetic unittest tests, all passing
  • no real network calls in unit tests

Related Issues

Test Evidence

$ python -m unittest tests.test_repo_architect -v
...
Ran 251 tests in 2.276s

OK
$ python -m unittest tests.test_repo_architect.TestDelegationDryRun -v
...
Ran 9 tests in 0.136s

OK

CodeQL: 0 alerts (actions + python)
Code review tool: no actionable comments

Checklist

  • Tests pass locally (pytest tests/)
  • Code is formatted (black . and isort .)
  • Documentation updated (if applicable)
  • No secrets or credentials committed
  • Related issue linked above
Original prompt

Implement Continuous Issue → Execution → PR → Ingestion → Replanning Loop for repo-architect

Context

You are working inside BraveNewCapital/GodelOS_StrangeDevLoop. The repo-architect system currently generates bounded implementation issues (issue-first governance). Your task is to extend it into a closed, stateful execution loop without replacing the issue-first model.

Read these files first — treat them as authoritative

  • docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md
  • docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md
  • docs/repo_architect/OPERATOR_GUIDE.md
  • repo_architect.py
  • .github/workflows/repo-architect.yml

Goal

Keep issue-first governance as the default planning mode, but close the loop so that:

  1. Generated issues can be delegated to GitHub Copilot coding agent
  2. Resulting PRs are tracked and reconciled back into repo-architect state
  3. Future planning runs ingest previous issues and PR outcomes
  4. The whole system can run on a schedule with concurrency guards
  5. Progression becomes linear and stateful rather than stateless and repetitive

Target Architecture

Planning lane:   analyze -> diagnose -> dedupe -> create/update issue
Execution lane:  select ready issue -> delegate to Copilot -> wait for PR -> reconcile PR outcome
Memory lane:     ingest issue/PR state -> update machine-readable work state -> feed next planning cycle
Scheduler lane:  run automatically on a schedule with safe gating and no duplicate execution

Hard Constraints

  • repo-architect must NOT directly write production code diffs as its default mode
  • Issue-first governance remains the default planning behavior
  • Copilot coding agent or issue assignment is the execution mechanism
  • Planning must ingest prior issues and PRs before generating new ones
  • Never delegate duplicate work for the same fingerprint or lane
  • Never spray multiple overlapping issues/PRs for the same objective unless explicitly configured
  • Preserve charter-defined mutation lanes as architectural concepts
  • Keep everything auditable and machine-readable

Implementation Requirements

1. Add Durable Work-State Ingestion

Implement a machine-readable state layer (prefer JSON) that records at minimum:

  • objective
  • lane
  • issue_number
  • issue_fingerprint
  • issue_state
  • delegation_state
  • assignee
  • pr_number / pr_url (if any)
  • pr_state
  • merged / closed outcome
  • blocked / superseded status
  • created_at / updated_at timestamps
  • run_id or workflow provenance

Use reports/ or an existing state location if appropriate. Make it easy for repo_architect.py to read and update.

2. Add Issue Execution Selection

Implement deterministic, testable logic that selects one ready issue for execution.

Selection rules:

  • Only issues with labels: arch-gap, copilot-task, needs-implementation
  • Exclude: blocked, superseded, already-in-progress, or already-linked-to-open-PR issues
  • Prefer highest priority first
  • Prefer smallest bounded issue within the same active objective
  • Do not select more than one issue per lane at a time
  • Do not select multiple issues with the same fingerprint

3. Add Copilot Delegation Support

Implement an execution path that delegates a selected issue to GitHub Copilot coding agent.

Support:

  • Dry-run mode: reports what would be delegated, no side effects
  • Live mode: marks or assigns the issue for Copilot execution (use actual GitHub API mechanisms — assignment, labels, comment, or workflow_dispatch as appropriate)
  • Recording the delegation event in work state

Do not fake delegation. Use actual repository mechanisms that fit GitHub + Copilot workflow.

4. Add PR Reconciliation

Implement ingestion of PR state back into repo-architect state.

For issues created/generated by repo-architect, detect:

  • Open PR linked to the issue
  • Merged PR
  • Closed-unmerged PR
  • Draft PR
  • Stale PR
  • Superseding PR

Update issue/work state accordingly so reconciliation can answer:

  • Is this issue already being worked?
  • Did it result in a PR?
  • Did the PR merge?
  • Should the planner generate follow-on work or not?

5. Make Planning Stateful

Update planning so the next planning pass ingests:

  • Current open generated issues
  • Previous generated issues
  • Current open PRs linked to those issues
  • Recently merged or closed PR outcomes
  • State artifact from prior runs

Use this to avoid:

  • Regenerating the same issue repeatedly
  • Creating a follow-on issue before the previous step lands
  • Selecting work blocked by an active issue/PR in the same lane/objective

Planning should be objective-aware. Add or extend an objective concept such as:

  • restore-parse-correctness
  • eliminate-import-cycles
  • converge-runtime-structure
  • reduce-architecture-score-risk

Each new issue should advance a concrete objective; the next issue should prefer the next bounded step in that objective.

6. Add...

Custom agent used: Oli
Oliver Chimera Profile

This pull request was created from Copilot chat.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

… repo-architect

- Add WorkItem dataclass and durable work_state.json (memory lane)
- Add select_ready_issue() with deterministic priority-ordered selection
- Add delegate_to_copilot() with dry-run/live mode and GitHub API integration
- Add reconcile_pr_state() ingesting open/merged/closed/stale PR outcomes
- Add run_execution_cycle() and run_reconciliation_cycle() entry points
- Update run_issue_cycle() to filter out already-in-progress fingerprints
- Add lifecycle labels: ready-for-delegation, in-progress, pr-open, merged, blocked, superseded
- Add OBJECTIVE_LABELS dict with 7 canonical architectural objectives
- Extend Config with 7 new operator control fields
- Validate new env vars: ACTIVE_OBJECTIVE, ENABLE_LIVE_DELEGATION, MAX_CONCURRENT_DELEGATED, STALE_TIMEOUT_DAYS, RECONCILIATION_WINDOW_DAYS
- Add --mode execution/reconcile CLI args + operator flags
- Add dedicated workflow files: repo-architect-execution.yml (every 2h), repo-architect-reconcile.yml (every 4h)
- Simplify repo-architect.yml schedule to planning only; remove invalid github.event.schedule conditions
- Add 47 new tests across 7 test classes (231 total, all passing)
- Rewrite OPERATOR_GUIDE.md to document all four lanes, work state schema, label lifecycle, dry-run vs live, and scheduled automation

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement continuous issue to execution loop for repo-architect feat(repo-architect): closed-loop execution → PR → ingestion → replanning Mar 16, 2026
Copilot AI requested a review from Steake March 16, 2026 09:37
@Steake
Copy link
Copy Markdown

Steake commented Mar 16, 2026

@copilot

You are working on PR #65 in BraveNewCapital/GodelOS_StrangeDevLoop.

Read first and treat as authoritative:

  • docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md
  • docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md
  • docs/repo_architect/OPERATOR_GUIDE.md
  • repo_architect.py
  • .github/workflows/repo-architect.yml
  • .github/workflows/repo-architect-execution.yml
  • .github/workflows/repo-architect-reconcile.yml

Your task is to harden the closed-loop repo-architect execution system so it is operationally trustworthy rather than merely plausible.

Do not stop at analysis.
Do not leave TODOs where concrete implementation is possible.
Do not weaken the issue-first model.
Make targeted repo changes now.

Current weak points to fix

  1. Copilot delegation may be ceremonial rather than a real trigger.
    The current live path appears to add in-progress, assign @copilot+gpt-5.3-codex, and post a delegation comment.
    You must make delegation explicit, observable, and verifiable.

  2. PR reconciliation is too brittle.
    The current matching appears to rely on #issue_number references in PR text.
    You must implement stronger issue-to-PR linkage.

  3. Lifecycle semantics are too interpretive.
    The current mapping of:

  • PR closed/unmerged -> superseded
  • stale/no PR -> blocked
    is not reliably true.
    You must replace these with factual states.

Required implementation changes

A. Make delegation verifiable

Implement delegation so the system can prove what happened.

Required behavior:

  • record a delegation event in work state with timestamp, mechanism, target issue, and outcome
  • distinguish:
    • delegation_requested
    • delegation_confirmed
    • delegation_failed
  • if the repository’s actual supported trigger is assignment to Copilot, keep that path but record explicit confirmation of the API response
  • if a comment trigger is used, record the exact comment URL/id returned by GitHub
  • if both assignment and comment are used, record both separately
  • if there is no reliable trigger confirmation, mark the delegation state as unconfirmed rather than pretending execution has started

Do not treat “label added” alone as proof of actual execution.

Update docs and tests accordingly.

B. Strengthen issue-to-PR linkage

Implement stronger PR association than plain #issue_number text matching.

Use as many reliable signals as are available and practical, in priority order:

  1. explicit issue fingerprint in PR body
  2. explicit machine marker or metadata block in PR body
  3. branch naming convention linked to issue/fingerprint
  4. closing keywords / linked issue references
  5. fallback text mention of #issue_number

When repo-architect delegates an issue, ensure the issue body/comment includes the machine-readable linkage material Copilot should carry into the PR.

When reconciling, prefer exact machine linkage over loose textual inference.

Update tests for:

  • exact fingerprint match
  • branch-name-only match
  • fallback issue-number match
  • ambiguous/multiple PR cases
  • no-match case

C. Replace interpretive lifecycle states with factual states

Do not encode assumptions as labels or state names.

Replace or refactor lifecycle/state handling so facts are represented directly, for example:

  • ready-for-delegation
  • delegation-requested
  • in-progress
  • pr-open
  • pr-draft
  • merged
  • closed-unmerged
  • stale
  • blocked-by-dependency
  • superseded-by-issue
  • superseded-by-pr
  • failed-delegation

The exact naming can differ, but it must separate:

  • objective facts
    from
  • inferred planning meaning

Do not label a closed unmerged PR as superseded unless there is explicit evidence of a superseding issue/PR.
Do not label stale as blocked unless there is explicit blocking evidence.

Planning may infer that stale work should be deprioritized, but the stored state must remain factual.

D. Tighten reconciliation rules

Update reconcile_pr_state() so it:

  • records why a PR was matched
  • records the evidence type used for the match
  • records whether the match confidence is exact / strong / weak
  • avoids silently overwriting a stronger match with a weaker one
  • handles multiple PRs referencing the same issue
  • handles reopened PRs or reopened issues if practical

Persist reconciliation evidence in work state.

E. Update work state schema

Extend .agent/work_state.json and any in-memory models to include:

  • delegation_mechanism
  • delegation_requested_at
  • delegation_confirmed_at
  • delegation_confirmation_evidence
  • delegation_comment_url or id if applicable
  • delegation_assignment_evidence if applicable
  • pr_match_method
  • pr_match_confidence
  • pr_match_evidence
  • lifecycle_fact_state
  • lifecycle_inferred_state if needed separately

Keep the schema machine-readable and documented.

F. Update operator docs

Document:

  • what counts as confirmed delegation
  • what counts as PR linkage evidence
  • factual lifecycle states versus inferred planning interpretations
  • how reconciliation decides match strength
  • how to inspect work state for proof of delegation and PR association

G. Update tests

Add or update hermetic tests for:

  • delegation requested vs confirmed vs failed
  • reconciliation by fingerprint marker
  • reconciliation by explicit linkage block
  • fallback reconciliation by issue number
  • ambiguous multiple PR references
  • factual lifecycle state transitions
  • no false superseded on closed-unmerged PR
  • no false blocked on mere staleness

Constraints

  • Preserve issue-first planning as default
  • Do not reintroduce autonomous code mutation
  • Prefer targeted changes over broad rewrites
  • Keep the loop auditable
  • Keep scheduling/concurrency behavior intact unless a change is required to support the stronger execution contract

Success condition

This task is complete only when:

  • delegation has explicit, machine-readable proof rather than optimistic assumption
  • PR reconciliation is stronger than naive #issue_number matching
  • lifecycle states represent facts, not stories
  • work state records enough evidence for later planning and debugging
  • docs and tests reflect the new contract

When done, output a concise summary with these headings:

  • Delegation hardening
  • PR linkage hardening
  • Lifecycle/state changes
  • Work state schema changes
  • Workflow/doc changes
  • Test changes
  • Remaining limitations

…d factual lifecycle states

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

@copilot

You are working on PR #65 in BraveNewCapital/GodelOS_StrangeDevLoop.
...

Implemented in commit 6ecfaaa.

This hardens delegation with explicit requested/confirmed/failed/unconfirmed outcomes plus mechanism evidence, strengthens PR linkage matching with ordered evidence methods and confidence tracking, separates factual lifecycle state from inferred planning state, persists reconciliation evidence in work state, updates operator docs, and adds hermetic tests for delegation proof, linkage methods (including ambiguous/no-match), and factual lifecycle transitions.

Copilot AI changed the title feat(repo-architect): closed-loop execution → PR → ingestion → replanning feat(repo-architect): harden closed-loop execution with verifiable delegation and evidence-based PR reconciliation Mar 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 16, 2026

🧪 CI — Python 3.10

�[31mERROR�[0m tests/test_cognitive_subsystem_activation.py::�[1mTestEndToEndFlow::test_context_engine_round_trip�[0m - ModuleNotFoundError: No module named 'requests'
�[31mERROR�[0m tests/test_cognitive_subsystem_activation.py::�[1mTestEndToEndFlow::test_nlg_pipeline_process�[0m - ModuleNotFoundError: No module named 'requests'
�[31m===== �[31m�[1m4 failed�[0m, �[32m1266 passed�[0m, �[33m81 skipped�[0m, �[33m65 warnings�[0m, �[31m�[1m22 errors�[0m�[31m in 40.74s�[0m�[31m ======�[0m

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 16, 2026

🧪 CI — Python 3.11

�[31mERROR�[0m tests/test_cognitive_subsystem_activation.py::�[1mTestEndToEndFlow::test_context_engine_round_trip�[0m - ModuleNotFoundError: No module named 'requests'
�[31mERROR�[0m tests/test_cognitive_subsystem_activation.py::�[1mTestEndToEndFlow::test_nlg_pipeline_process�[0m - ModuleNotFoundError: No module named 'requests'
�[31m===== �[31m�[1m4 failed�[0m, �[32m1266 passed�[0m, �[33m81 skipped�[0m, �[33m65 warnings�[0m, �[31m�[1m22 errors�[0m�[31m in 42.31s�[0m�[31m ======�[0m

@Steake
Copy link
Copy Markdown

Steake commented Mar 16, 2026

@Steake

The delegation contract needs tightening.

GitHub Copilot coding agent is triggered by assigning the issue to Copilot. The issue body, description, and any comments that already exist at the time of assignment are sent to the agent. After assignment, Copilot does not react to further issue comments. That means the current live path should treat assignment as the actual execution trigger, while any delegation comment is audit-only rather than part of the trigger/confirmation contract.

Required changes:

  • make issue assignment the sole triggering action in delegate_to_copilot()
  • ensure all task context is present in the issue body or pre-assignment comments
  • do not treat a post-assignment issue comment as evidence that Copilot received new instructions
  • record delegation proof from assignment/API response and current assignee state
  • update docs/tests to reflect that @copilot comments are for PR iteration, not issue intake

Also note that Copilot PR workflows are not triggered by default until a user with write access approves them, unless repository settings allow automatic workflow runs. The closed-loop automation docs should account for that gate explicitly.

@Steake
Copy link
Copy Markdown

Steake commented Mar 16, 2026

@copilot

@Steake

The delegation contract needs tightening.

GitHub Copilot coding agent is triggered by assigning the issue to Copilot. The issue body, description, and any comments that already exist at the time of assignment are sent to the agent. After assignment, Copilot does not react to further issue comments. That means the current live path should treat assignment as the actual execution trigger, while any delegation comment is audit-only rather than part of the trigger/confirmation contract.

Required changes:

  • make issue assignment the sole triggering action in delegate_to_copilot()
  • ensure all task context is present in the issue body or pre-assignment comments
  • do not treat a post-assignment issue comment as evidence that Copilot received new instructions
  • record delegation proof from assignment/API response and current assignee state
  • update docs/tests to reflect that @copilot+claude-opus-4.6 comments are for PR iteration, not issue intake

Also note that Copilot PR workflows are not triggered by default until a user with write access approves them, unless repository settings allow automatic workflow runs. The closed-loop automation docs should account for that gate explicitly.

Copilot AI and others added 2 commits March 16, 2026 17:42
…t linkage comment before assignment, document workflow approval gate

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
…ence

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

@copilot

@Steake
...

Implemented in 71329a5:

  • Assignment is the sole trigger: delegation_mechanism changed from "assignment+comment" to "assignment". Confirmation is based exclusively on the assignment API response.
  • Comment posted before assignment: The audit/linkage comment is now posted before the assignment call so Copilot receives it as part of the issue context at assignment time.
  • Comment failure doesn't block: If the audit comment fails but assignment succeeds, delegation is still confirmed — the comment is audit-only.
  • Comment evidence tagged: "role": "pre-assignment-audit" in comment evidence makes it explicit that the comment is not part of the trigger contract.
  • Workflow approval gate documented: New section in OPERATOR_GUIDE.md explaining that Copilot PR workflows require write-access user approval unless repo settings allow automatic runs.
  • Automated lane docs updated: Clarifies that @copilot issue comments after assignment are for human audit only; PR review comments are the path for iteration.
  • Added 2 new tests: test_live_mode_confirmed_even_without_audit_comment and test_live_mode_comment_posted_before_assignment (verifies call ordering).
  • 243 tests passing, CodeQL 0 alerts.

@Steake Steake marked this pull request as ready for review March 16, 2026 18:11
Copilot AI review requested due to automatic review settings March 16, 2026 18:11
Copy link
Copy Markdown

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

This PR extends repo_architect.py from issue-first governance into a closed-loop system by introducing a durable work-state “memory lane”, an execution lane to delegate ready issues to the GitHub Copilot coding agent, and a reconciliation lane to ingest PR outcomes back into work state.

Changes:

  • Add durable .agent/work_state.json tracking (WorkItem), issue selection (execution), and PR reconciliation (reconcile) flows in repo_architect.py.
  • Add extensive unittest coverage for work state ingestion, selection/delegation behavior, and PR reconciliation.
  • Update operator documentation and introduce dedicated scheduled workflows for execution and reconciliation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
repo_architect.py Adds work-state persistence + execution/reconcile modes, selection/delegation logic, and PR linkage reconciliation.
tests/test_repo_architect.py Adds new test suites validating the new work-state/execution/reconcile behaviors.
docs/repo_architect/OPERATOR_GUIDE.md Documents the four-lane model, new modes, labels, and workflows.
.github/workflows/repo-architect.yml Updates dispatch inputs to mention new modes and expands schedule description.
.github/workflows/repo-architect-execution.yml New scheduled/manual workflow to run execution lane.
.github/workflows/repo-architect-reconcile.yml New scheduled/manual workflow to run reconciliation lane.

new_it["updated_at"] = now
new_it["run_id"] = run_id
new_it.setdefault("lifecycle_fact_state", "ready-for-delegation")
upsert_work_item(work_state, WorkItem(**new_it))
]
if filtered_gaps:
gaps = filtered_gaps
# If all gaps are filtered, still proceed with original list so planner isn't blocked
Comment on lines +2279 to +2296
# Fetch eligible issues from GitHub
candidate_issues = _list_github_issues_by_labels(
config, list(EXECUTION_ELIGIBLE_LABELS), state="open"
)

filtered: List[Tuple[Dict[str, Any], Optional[str], Optional[str]]] = []
blocking_lifecycle = {
"blocked-by-dependency", "superseded-by-issue", "superseded-by-pr",
"delegation-requested", "in-progress", "pr-open", "pr-draft",
"merged", "closed-unmerged", "failed-delegation",
} | set(LEGACY_LIFECYCLE_LABELS)

for issue in candidate_issues:
issue_labels: Set[str] = {
lbl["name"]
for lbl in issue.get("labels", [])
if isinstance(lbl, dict)
}
Comment on lines +2284 to +2290
filtered: List[Tuple[Dict[str, Any], Optional[str], Optional[str]]] = []
blocking_lifecycle = {
"blocked-by-dependency", "superseded-by-issue", "superseded-by-pr",
"delegation-requested", "in-progress", "pr-open", "pr-draft",
"merged", "closed-unmerged", "failed-delegation",
} | set(LEGACY_LIFECYCLE_LABELS)

Comment on lines +78 to +83
- name: Ensure artifact directories exist
run: mkdir -p .agent docs/repo_architect

- name: Run repo architect (execution mode)
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Ensure artifact directories exist
run: mkdir -p .agent docs/repo_architect

Comment on lines 132 to 138
default: 'parse_errors,import_cycles,entrypoint_consolidation,hygiene,report'
type: string
schedule:
# Planning: hourly gap detection and issue synthesis
- cron: '17 * * * *'

concurrency:
Comment on lines +7 to +14
description: 'Operating mode. ''issue'' (default safe governance mode). ''execution'' selects one ready issue and delegates to Copilot. ''reconcile'' ingests PR outcomes. ''analyze'' is read-only. ''report''/''mutate''/''campaign'' are charter-validated mutation-capable modes (§9–§11).'
required: true
default: 'issue'
type: choice
options:
- issue
- execution
- reconcile

permissions:
contents: read
issues: write
@Steake
Copy link
Copy Markdown

Steake commented Mar 16, 2026

@copilot apply changes based on the comments in this thread

…ing, gap filtering, workflow persistence, permissions

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
… level

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

@copilot apply changes based on the comments in this thread

All 9 review comments addressed in commits ad03bb7 and c8e7e47:

  1. Schema-tolerant ingestion_normalize_work_item_dict() filters persisted dicts to current WorkItem fields and fills defaults for missing required fields. Prevents TypeError on older-schema items.
  2. No fallback to unfiltered gaps — planner returns empty selection when all gaps are filtered by active fingerprints.
  3. PR filtering_list_github_issues_by_labels() excludes items with pull_request key.
  4. ready-for-validation blocks delegation — added to blocking lifecycle set in select_ready_issue().
    5–7. Work state persistenceactions/cache/restore@v4 + actions/cache/save@v4 added to all three workflows with versioned keys (v1).
  5. Removed execution/reconcile from main workflow dispatch — operators pointed to dedicated workflows.
  6. pull-requests: read added to execution workflow permissions.

251 tests passing, CodeQL 0 alerts.

@Steake
Copy link
Copy Markdown

Steake commented Mar 16, 2026

@copilot

The branch may now be correct, but the visible PR contract is still stale.

The current PR description still says:

  • live delegation adds in-progress, assigns @copilot+gpt-5.4, and posts a delegation comment
  • PR reconciliation matches by #issue_number
  • closed/unmerged -> superseded
  • stale -> blocked

If the latest commits changed those semantics, the PR description/docs need to be updated to match the actual code before merge.

Please make the PR self-consistent:

  • state clearly that issue assignment is the sole execution trigger
  • state that any audit/linkage comment is posted before assignment and is audit-only
  • state that post-assignment issue comments do not affect Copilot
  • update reconciliation/lifecycle wording to reflect the current factual state model
  • refresh the reported test count

Right now the branch may be ahead of the PR narrative, but the merge surface still advertises the older contract.

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

@copilot

The branch may now be correct, but the visible PR contract is still stale.
...

Updated in 7e440c8.

The operator guide now states that assignment is the sole execution trigger, the pre-assignment linkage comment is audit-only context, post-assignment issue comments do not affect Copilot, the lifecycle/reconciliation wording reflects the factual state model, and the visible PR checklist now reflects the current 251-test count. No UI changes in this update.

@Steake Steake merged commit 2f1faaf into main Mar 16, 2026
2 checks passed
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.

3 participants