Skip to content

fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening, workflow-permission alignment#47

Merged
Steake merged 18 commits intomainfrom
copilot/update-repository-operating-model
Mar 15, 2026
Merged

fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening, workflow-permission alignment#47
Steake merged 18 commits intomainfrom
copilot/update-repository-operating-model

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 14, 2026

Description

Addresses all outstanding review items preventing merge across multiple review rounds:

1. dependency_contract.json charter §6 reconciliation

  • Removed invalid self-referential $schema
  • Replaced misleading "dependencies flow outward from runtime" with unambiguous "depends-on" chain matching Lane 5 detection logic
  • Added layer_order_semantics clarifying index 0 = foundation
  • Replaced overly strict "adjacent inner layer only" claim with charter's actual directional flow language ("Dependencies flow inward: outer layers depend on inner layers")
  • Added lane_5_enforcement section documenting what Lane 5 actually checks (§6.1 hard prohibitions) vs what it allows, making the contract trustworthy for tooling/agents consuming it

2. Hard exception normalization in find_existing_github_issue()

  • Catch-all except Exception wraps any non-RepoArchitectError (TypeError, KeyError, JSONDecodeError, etc.) into RepoArchitectError
  • Pre-normalized errors re-raised unchanged
try:
    ...
except RepoArchitectError:
    raise
except Exception as exc:
    raise RepoArchitectError(f"Dedupe lookup failed: {exc}") from exc

3. Labels requested vs confirmed distinction

  • labels_applied on IssueAction now documents as labels requested by the orchestration layer (deterministic label set sent to the API)
  • New labels_confirmed: Optional[List[str]] on IssueAction, populated from GitHub API response via _extract_confirmed_labels() helper — this is the API proof of what labels were actually set
  • Both create and update paths extract confirmed labels; dry-run/error paths → None
  • OPERATOR_GUIDE documents both fields with explicit semantics: labels_applied = "requested by orchestration", labels_confirmed = "returned by GitHub API after create/update"
  • TestLabelsConfirmed tests verify the distinction across update, create, dry-run, and error paths

4. Generated report artifacts removed from tracking

  • git rm --cached the 5 per-run .md reports (runtime_inventory, circular_dependencies, parse_errors, entrypoint_clusters, top_risks)
  • Added to .gitignore; §15 companion JSONs and OPERATOR_GUIDE.md remain tracked
  • Dry-run issue previews under docs/repo_architect/issues/ gitignored and removed from tracking — these are per-run generated artifacts that should not live in-tree

5. IssueAction API contract accuracy

  • Removed dead "skipped" action value from IssueAction.action doc (never produced by synthesize_issue())
  • Removed dead "skipped" summary branch in run_issue_cycle
  • Updated OPERATOR_GUIDE: dedupe_result table now includes lookup_failed and create_failed; added labels_confirmed and error fields; removed stale skipped example output

6. Test robustness

  • Added check=True to all git add/git commit subprocess.run() calls in tests to fail fast on errors
  • Added check=True to git identity config subprocess calls in test repo setup helpers to fail fast consistently

7. Workflow issue_subsystem input validation

  • Changed from free-form string to choice input matching SUBSYSTEM_LABELS (with empty '' default for all), preventing typos from causing argument parsing failures

8. Lane 7 agent boundary detection fix

  • Added _agent_name() helper that extracts the segment immediately after "agents" in module segments (e.g. "planner" from backend.agents.planner.core)
  • Lane 7 now only flags imports between different named agents, not same-agent imports at different module depths (e.g., backend.agents.foobackend.agents.foo.utils is no longer a false positive)

9. Follow-up fixes from review thread #3950064310

  • Removed self-referential $schema fields from:
    • docs/repo_architect/policy.json
    • docs/repo_architect/mutation_lanes.json
  • Aligned find_existing_github_issue() docstring with implemented behavior (no longer claims non-dict response shape raises)
  • Replaced stale docs/repo_architect/top_risks.md references in architecture-score gap outputs with the current analysis artifact path (analysis_path)
  • Added validation for REPO_ARCHITECT_SUBSYSTEM env var in build_config() against SUBSYSTEM_LABELS; invalid values now raise RepoArchitectError
  • Added/updated tests for:
    • invalid REPO_ARCHITECT_SUBSYSTEM env value rejection
    • architecture-score gap suggested files/notes using analysis artifact path and no top_risks.md dependency

10. Follow-up fixes from review thread #3950079463

  • Ensured dedupe-failure log path preserves output mode consistency by passing json_mode=config.log_json
  • Updated workflow mode semantics so report runs in the mutation-capable job with write permissions, while issue/analyze/schedule remain in the issue/read-only path
  • Corrected workflow input description to match actual behavior (analyze read-only; report mutation-capable)
  • Reconciled dependency_contract.json wording so allowed_direction and lane_5_enforcement.not_flagged are internally consistent and unambiguous for tooling
  • Added regression test for dedupe lookup failure logging behavior under JSON log mode

Related Issues

Test Evidence

184 tests pass (including latest follow-up coverage):

Test class Count Covers
TestDependencyContractCharterAlignment 4 No self-schema, layer order, direction semantics, contract wording alignment
TestDedupeHardExceptionNormalization 5 TypeError/KeyError/RuntimeError → RepoArchitectError, passthrough
TestLabelsConfirmed 4 Update path, create path, dry-run=None, error=None — validates requested vs confirmed distinction
TestGeneratedReportArtifactsGitignored 2 .gitignore entries, git ls-files untracked
TestAgentName 4 Standard agent module, boundary, no-agents, agents-at-end
TestLane7SameAgentNotFlagged 2 Same-agent-different-depth NOT flagged, cross-agent still flagged
TestModelConfiguration +1 assertion Rejects invalid REPO_ARCHITECT_SUBSYSTEM env value
TestDiagnoseGaps +1 assertion Architecture-score gap references analysis artifact, not removed report markdown
TestIssueSynthesisDeduplication +1 test Dedupe lookup failure log respects config.log_json
python -m unittest tests.test_repo_architect -v
Ran 184 tests in 1.941s
OK

Additional verification:

  • Targeted suites for latest fixes passed:
    • TestIssueSynthesisDeduplication
    • TestDependencyContractCharterAlignment
  • Automated code review run: no remaining comments
  • CodeQL: 0 alerts

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

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

Copilot AI and others added 2 commits March 14, 2026 18:15
- Add ISSUE_MODE, DEPRECATED_MUTATION_MODES, ARCH_GAP_LABELS, SUBSYSTEM_LABELS,
  ISSUE_PRIORITY_LEVELS, ISSUE_REPORT_DIR constants
- Add ArchGap and IssueAction dataclasses
- Add dry_run, max_issues, issue_subsystem fields to Config
- Add issue_fingerprint(), render_issue_body(), find_existing_github_issue(),
  ensure_github_labels(), create_github_issue_api(), update_github_issue_api(),
  synthesize_issue(), diagnose_gaps(), run_issue_cycle() functions
- Add deprecation warning to build_patch_plan() for mutate/campaign modes
- Update write_step_summary() for issue mode output
- Route run_cycle() issue mode to run_issue_cycle()
- Update parse_args() with --dry-run, --max-issues, --issue-subsystem flags;
  default mode changed from 'report' to 'issue'
- Update main() to route issue mode and emit deprecation warning for campaign
- Update build_config() to populate new Config fields
- Add 33 new tests covering fingerprint, body rendering, deduplication, labels,
  gap diagnosis, output schema, deprecated mode warning
- Rewrite .github/workflows/repo-architect.yml for issue-first model;
  change permissions from contents:write/pull-requests:write to issues:write
- Rewrite docs/repo_architect/OPERATOR_GUIDE.md describing new operating model

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
- Add comment explaining 12-char fingerprint collision probability
- Extract magic number 5 to _MAX_INLINE_FILE_DISPLAY constant
- Fix test to use module-level 're' instead of local 'import re as _re'
- Restore contents:write + pull-requests:write permissions in workflow
  (needed for deprecated mutate/campaign modes; comment added)

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove autonomous code mutation and implement issue-first orchestration feat: Convert repo-architect from autonomous code mutation to issue-first architectural governance Mar 14, 2026
Copilot AI requested a review from Steake March 14, 2026 18:22
@Steake
Copy link
Copy Markdown

Steake commented Mar 14, 2026

@copilot

This is a strong safety and governance improvement, but it needs to be reconciled explicitly with docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md and docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md. Those documents support diagnosis, reporting, and bounded governance, but they also preserve narrow, validated self-modification lanes rather than abolishing them outright. I’d merge this faster if the PR reframed issue-first orchestration as the new default/safe operating mode, retained the charter-defined lane model in code and docs, and added an explicit reconciliation section showing how the new flow aligns with the two charter documents.

Reframe mutation modes as charter-validated secondary modes (per
GODELOS_REPO_IMPLEMENTATION_CHARTER §9–§10) rather than deprecated
features.  Add explicit charter reconciliation section to OPERATOR_GUIDE
showing alignment with both architectural charters.

Changes:
- Rename DEPRECATED_MUTATION_MODES → CHARTER_MUTATION_MODES
- Replace "⚠️ DEPRECATED" warnings with "ℹ️ charter-validated" notices
  that reference specific charter sections
- Update build_patch_plan docstring with charter alignment note
- Update parse_args help text: mutation modes labelled as
  "charter-validated secondary modes (§9–§10)" not deprecated
- Remove [DEPRECATED] labels from workflow inputs; add charter §refs
- Add full Charter Reconciliation section to OPERATOR_GUIDE with
  two alignment tables mapping to both charter documents
- Add "Lane-Based Mutation Modes" section documenting lanes 0–4,
  validation policy, and running instructions
- Add "Detected Gap Types" charter lane equivalents column
- Update test class from TestDeprecatedModeWarning →
  TestCharterValidatedModeNotice

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

Copilot AI commented Mar 14, 2026

@copilot

This is a strong safety and governance improvement, but it needs to be reconciled explicitly with docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md and docs/architecture/...

Reconciled in 2a6abd9. The key changes:

  1. Reframed mutation modes: mutate/campaign are now labelled as "charter-validated secondary modes" (referencing §9–§10 of GODELOS_REPO_IMPLEMENTATION_CHARTER) rather than deprecated. The runtime notice now reads ℹ️ charter-validated lanes instead of ⚠️ DEPRECATED. The constant was renamed from DEPRECATED_MUTATION_MODESCHARTER_MUTATION_MODES.

  2. Lane model retained in code and docs: Lane args (--lane, --lanes, --max-slices) no longer carry [DEPRECATED] prefixes in help text or workflow inputs. They reference charter §10/§11. The OPERATOR_GUIDE.md now has a full "Lane-Based Mutation Modes" section documenting all five lanes, their charter lane equivalents, validation policy, and running instructions.

  3. Charter reconciliation section added to OPERATOR_GUIDE.md with two alignment tables:

    • One mapping to GODELOS_ARCHITECTURAL_CHARTER (§14 Gödel-Machine, §15 Self-Modification Doctrine 15.1–15.5, §20 Automation Policy)
    • One mapping to GODELOS_REPO_IMPLEMENTATION_CHARTER (§9 Self-Modification Contract, §10 Lanes, §11 Budget, §12 PR Contract, §14 Priority Order)
    • Plus a "Why issue-first is the default" rationale grounded in §15.2 boundedness and the fact that higher lanes (5–9) exceed what the current analysis engine can safely validate.

All 126 tests pass.

Copilot AI changed the title feat: Convert repo-architect from autonomous code mutation to issue-first architectural governance feat: Convert repo-architect to issue-first governance with charter-reconciled lane model Mar 14, 2026
@Steake
Copy link
Copy Markdown

Steake commented Mar 14, 2026

@copilot You are working inside the repository BraveNewCapital/GodelOS_StrangeDevLoop.

Your task is to reconcile the current repository implementation with the authoritative architectural documents and update the repository accordingly.

The authoritative architectural sources are:

docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md
docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md

These files define the intended operating model and MUST be treated as the canonical architectural specification for the repository.

Do not infer architecture solely from existing code or workflows.
If implementation and documentation conflict, treat the architectural charters as the source of truth unless they are clearly obsolete.

Your job is to bring the repository into alignment with those charters while preserving the recent issue-first governance improvements introduced in PR #47.

Goal

Implement a charter-aligned operating model where:

  1. The system defaults to issue-first architectural governance
  2. The system still preserves charter-defined mutation lanes as a future or gated capability
  3. Workflows, runtime services, and documentation all reflect the same architecture

This means the system should diagnose architectural gaps and create structured GitHub Issues by default, but the architecture must still acknowledge controlled mutation lanes as defined in the implementation charter.

Steps you must perform

  1. Read the architectural documents

Inspect and extract the intended architecture from:

docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md
docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md

Identify the key architectural principles, including:

  • repo-architect loop purpose
  • mutation lane doctrine
  • thin validated PR model
  • architectural convergence goals
  • runtime structure expectations
  • governance and operator control

Do not proceed until you have extracted the intended model.

  1. Inspect the repository implementation

Inspect:

  • repo_architect runtime code
  • orchestration services
  • CLI entrypoints
  • workflow files in .github/workflows
  • issue generation logic
  • reporting artifacts
  • documentation under docs/

Determine where implementation diverges from the charters.

  1. Reconcile PR fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening, workflow-permission alignment #47 behavior with the charter

PR #47 introduced an issue-first governance model.

Preserve the following behaviors:

  • repository inspection
  • architectural gap diagnosis
  • deduplicated GitHub issue generation
  • structured issue templates
  • Copilot-ready implementation prompts
  • reporting artifacts
  • workflow execution

But modify the implementation so that:

Issue-first mode is the default orchestration mode, not a permanent replacement for mutation capability.

Mutation lanes defined in the implementation charter must still exist conceptually in:

  • diagnostics
  • prioritization
  • issue generation
  • documentation

Even if direct automated mutation is disabled in default runs.

  1. Update runtime behavior

Refactor the repo architect system so that:

Default run mode:

inspect repo
diagnose architectural gaps
prioritize gaps
deduplicate issues
open/update GitHub issue
record issue metadata in report

No default execution path should generate code diffs or branches.

However the system must still:

recognize mutation lanes defined in the charter such as:

  • parse repair
  • import cycle reduction
  • runtime entrypoint consolidation
  • interface normalization
  • dependency inversion
  • structural convergence

These lanes should appear in issue synthesis and diagnostics.

  1. Update workflows

Modify GitHub workflows so they:

run repo inspection and issue synthesis
upload architectural reports as artifacts
record created/updated issue URLs

Remove or disable automatic code mutation or branch generation from normal runs.

If legacy mutation paths exist, gate them behind an explicit disabled or experimental mode.

  1. Update documentation

Ensure the documentation under docs/ reflects the reconciled architecture.

Specifically update:

docs/repo_architect/OPERATOR_GUIDE.md (or equivalent)

Add a section titled:

Architectural Reconciliation

This section must explicitly reference:

docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md
docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md

Explain that:

  • issue-first governance is now the default execution model
  • mutation lanes defined in the implementation charter remain part of the architecture
  • automated mutation is currently gated for safety
  • the repo architect loop still diagnoses and prioritizes those lanes

Ensure docs do not contradict the architectural charters.

  1. Preserve architectural diagnostics

Ensure the system continues detecting important architectural gaps such as:

parse failures
import cycles
runtime entrypoint fragmentation
dependency violations
architectural drift

Ensure these map clearly to the mutation lanes defined in the implementation charter.

  1. Add architectural reconciliation report

At the end of your implementation produce a short summary describing:

Architecture documents consulted
Implementation drift found
Files modified
How runtime behavior was changed
How workflows were changed
How docs were updated
Any remaining inconsistencies requiring human review

Constraints

Do not invent new architecture that contradicts the charter documents.

Prefer modifying existing services and workflows rather than creating parallel systems.

Avoid large speculative rewrites when targeted changes achieve alignment.

Success condition

The repository must end in a state where:

  • runtime behavior matches the architectural charters
  • issue-first governance works as the default execution model
  • mutation lanes still exist as architectural concepts
  • workflows and docs reflect the same architecture
  • no default path automatically writes code or opens code PRs

Copilot AI and others added 2 commits March 14, 2026 20:33
…chitectural Reconciliation

- Add CHARTER_LANE_MAP constant mapping all 10 charter lanes (§10) to
  (name, subsystem, description) tuples
- Add "core", "knowledge", "agents", "consciousness" to SUBSYSTEM_LABELS
  for higher-lane gap detection
- Add Lane 5 (contract repair) gap detection for dependency direction
  violations in diagnose_gaps()
- Add Lane 7 (agent boundary enforcement) gap detection for cross-agent
  imports in diagnose_gaps()
- Rename "Charter Reconciliation" → "Architectural Reconciliation" in
  OPERATOR_GUIDE with expanded content:
  - Core principles from charters
  - Full 10-lane reference table with automation status
  - Expanded alignment tables for both charter documents
  - Updated "Why issue-first is the default" rationale
- Fix workflow comment: "Deprecated" → "Charter-validated" (line 234)
- Update Detected Gap Types table with Lanes 5 and 7
- Update subsystem labels list in docs
- Add 6 new tests: CHARTER_LANE_MAP completeness (3), higher-lane gap
  detection (3)

All 132 tests pass.

Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
…t _MAX_VIOLATIONS_DISPLAY, improve assertions

- Use pathlib.Path.parts for path segment matching instead of substring
  matching to reduce false positives in boundary detection
- Use pathlib.Path.parent for cross-agent parent comparison
- Extract _MAX_VIOLATIONS_DISPLAY = 5 constant for violation display limits
- Use assertGreaterEqual instead of assertTrue(len >= 1) in tests

All 132 tests pass.

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

Copilot AI commented Mar 14, 2026

@copilot You are working inside the repository BraveNewCapital/GodelOS_StrangeDevLoop.

Your task is to reconcile the current repository implementation with the authoritative architectural documents a...

Implemented in 374a72d + b41fea3. Here's the architectural reconciliation report:

Architecture documents consulted:

  • docs/architecture/GODELOS_ARCHITECTURAL_CHARTER.md (§14, §15.1–15.5, §20)
  • docs/architecture/GODELOS_REPO_IMPLEMENTATION_CHARTER.md (§9–§12, §14)

Implementation drift found and fixed:

  1. Only 5 of 10 charter lanes were represented in gap detection → added CHARTER_LANE_MAP with all 10 lanes
  2. SUBSYSTEM_LABELS lacked subsystems for higher lanes → added core, knowledge, agents, consciousness
  3. No gap detection for Lanes 5 (contract repair) or 7 (agent boundary enforcement) → added dependency direction and cross-agent import violation detection
  4. Workflow comment on line 234 said "Deprecated" → fixed to "Charter-validated (§9–§10)"
  5. OPERATOR_GUIDE section titled "Charter Reconciliation" → renamed to "Architectural Reconciliation" with expanded content

Files modified:

  • repo_architect.pyCHARTER_LANE_MAP constant, SUBSYSTEM_LABELS expansion, diagnose_gaps() Lanes 5+7
  • .github/workflows/repo-architect.yml — comment fix
  • docs/repo_architect/OPERATOR_GUIDE.md — full "Architectural Reconciliation" section with 10-lane table, both charter alignment tables, core principles, and rationale
  • tests/test_repo_architect.py — 6 new tests (132 total)

Runtime behavior: default mode is issue (no code generation, branching, or PRs). Mutation modes (mutate/campaign) require explicit --mode opt-in, emit charter-reference notice, and remain bounded by validation floors.

Remaining items requiring human review: Lanes 6, 8, 9 gap detection signals are stubbed in CHARTER_LANE_MAP but not yet actively detected (analysis engine doesn't yet produce the data). These will activate as the analysis engine evolves.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 14, 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, �[32m1199 passed�[0m, �[33m81 skipped�[0m, �[33m65 warnings�[0m, �[31m�[1m22 errors�[0m�[31m in 38.88s�[0m�[31m ======�[0m

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 14, 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, �[32m1199 passed�[0m, �[33m81 skipped�[0m, �[33m65 warnings�[0m, �[31m�[1m22 errors�[0m�[31m in 37.15s�[0m�[31m ======�[0m

@Steake Steake marked this pull request as ready for review March 14, 2026 21:01
Copilot AI review requested due to automatic review settings March 14, 2026 21:01
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 shifts repo_architect.py from an automated code-mutation workflow to an issue-first architectural governance tool, while preserving the charter-defined lane-based mutation model as an explicit opt-in secondary mode.

Changes:

  • Adds an issue synthesis pipeline (gap diagnosis → fingerprinted dedupe → create/update GitHub Issues or dry-run artifacts).
  • Introduces charter lane metadata (10-lane map + subsystem labels) and new higher-lane gap signals (Lanes 5 and 7).
  • Updates workflow inputs/permissions and expands tests + operator documentation for the new issue-first default.

Reviewed changes

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

Show a summary per file
File Description
repo_architect.py Adds issue-first mode, gap diagnosis, dedupe via fingerprints, GitHub Issue create/update, and charter lane metadata.
tests/test_repo_architect.py Adds tests for issue-first behavior (fingerprint, body rendering, dedupe, labels, gap diagnosis, schema, lane map).
docs/repo_architect/OPERATOR_GUIDE.md Rewrites operator guidance around issue-first governance, charter reconciliation, and updated CLI/workflow usage.
.github/workflows/repo-architect.yml Switches default mode to issue, adds issue-mode inputs, and grants issues: write permission.
docs/repo_architect/issues/1a3e5f0dc392.md Example dry-run issue artifact for parse-error gap.
docs/repo_architect/issues/39189bfe6f6c.md Example dry-run issue artifact for import-cycle gap.
.agent/roadmap.json Updated generated roadmap artifact reflecting current analysis.
.agent/repo_architect_state.json Adds/updates issue-mode run history state artifact.
.agent/code_graph.json Updated generated code graph artifact.
.agent/artifacts_manifest.json New/updated artifact manifest including dry-run issue previews.

Comment on lines +1184 to +1194
agent_violations: List[str] = []
for src, targets in import_graph.items():
if not isinstance(targets, list):
continue
src_parts = pathlib.Path(str(src)).parts
if "agents" in src_parts:
for tgt in targets:
tgt_parts = pathlib.Path(str(tgt)).parts
# Agent reaching into another agent's internal module
if "agents" in tgt_parts and pathlib.Path(str(src)).parent != pathlib.Path(str(tgt)).parent:
agent_violations.append(f"{src} → {tgt}")
Comment on lines +954 to +973
cycles = analysis.get("cycles", [])
if cycles:
cycle_files: List[str] = []
for c in cycles[:5]:
cycle_files.extend(c)
cycle_files = list(dict.fromkeys(cycle_files))[:10]
add(ArchGap(
subsystem="runtime",
issue_key="import-cycles",
title=f"[arch-gap] Break {len(cycles)} circular import cycle(s)",
summary=f"The codebase has {len(cycles)} circular import cycle(s) that degrade startup performance and complicate testing.",
problem=(
f"Example cycle: {' → '.join(cycles[0]) if cycles else 'see analysis'}.\n"
"Circular imports force the interpreter to partially execute modules, causing subtle "
"AttributeError and ImportError bugs."
),
why_it_matters="Circular imports increase coupling, slow startup, and block modular testing.",
scope=f"Break the top {min(len(cycles), 3)} import cycle(s) using TYPE_CHECKING guards or lazy imports.",
suggested_files=cycle_files,
implementation_notes=(
Comment on lines +698 to +707
try:
result = github_request(config.github_token, f"/search/issues?{query}")
items = result.get("items", []) if isinstance(result, dict) else []
for item in items:
body = item.get("body") or ""
if marker in body:
return item
except RepoArchitectError:
pass
return None
Comment on lines +836 to +842
labels_applied=[], dedupe_result="existing_open", fingerprint=fp,
dry_run_path=None, gap_title=gap.title, gap_subsystem=gap.subsystem,
error=str(exc),
)
return IssueAction(
action="updated", issue_number=issue_number, issue_url=issue_url,
labels_applied=[], dedupe_result="existing_open", fingerprint=fp,
| 3 | `entrypoint_consolidation` | Annotates one redundant backend server entrypoint with a `# DEPRECATED` comment when ≥ 4 backend entrypoints exist. Model-assisted. |
| 4 | `hygiene` | Remove explicitly `# DEBUG`-marked `print()` statements. No model required. |
| 5 | `report` | Refresh the architecture documentation packet. Only selected when no higher-priority code mutation is possible. |
| `--mode issue` | required | Enable issue-first mode |
Comment on lines +3030 to +3032
p.add_argument("--issue-subsystem", default=None,
help="Issue mode: restrict gap detection to a specific subsystem "
f"(choices: {', '.join(SUBSYSTEM_LABELS)}).")
Comment on lines +1786 to +1789
"local_import_graph": {
"backend/interface/api.py": ["backend/core/engine.py"],
},
}
Comment on lines 81 to 85
permissions:
contents: write
pull-requests: write
contents: write # required for mutation modes (branch push); read-only for issue mode
issues: write # required for issue-first mode (open/update GitHub Issues)
pull-requests: write # required for mutation modes (PR creation)
models: read
Comment on lines +1137 to +1144
src_parts = pathlib.Path(str(src)).parts
for tgt in targets:
tgt_parts = pathlib.Path(str(tgt)).parts
# Detect cross-boundary imports per §6 Dependency Direction Contract
if ("interface" in src_parts and "core" in tgt_parts) or \
("knowledge" in src_parts and "runtime" in tgt_parts) or \
("agents" in src_parts and "interface" in tgt_parts):
boundary_violations.append(f"{src} → {tgt}")
@Steake
Copy link
Copy Markdown

Steake commented Mar 14, 2026

@copilot apply changes based on the comments in this thread

…tion, dedupe, docs, and workflow permissions

1. Fix Lane 5/7 detection: add _module_segments() to normalize module names
   (dot-separated) into segments instead of using pathlib.Path on them.
2. Fix import cycle suggested_files: add _module_to_path() to map module
   names back to file paths using python_files analysis data.
3. Fix find_existing_github_issue: raise RepoArchitectError on API failures
   instead of silently swallowing — synthesize_issue now logs and returns
   error action on dedupe lookup failure.
4. Fix IssueAction.labels_applied: populate labels for existing-issue
   update and error paths.
5. Fix OPERATOR_GUIDE.md: --mode issue is the default, not required.
6. Fix --issue-subsystem: add argparse choices=SUBSYSTEM_LABELS validation.
7. Fix tests: use module-name format matching build_analysis() output.
8. Workflow: split into two jobs (repo-architect-issue with least privilege
   and repo-architect-mutate with elevated permissions) gated by mode.
9. Add 9 new tests covering _module_segments, _module_to_path, dedupe
   failure, and import cycle suggested_files mapping.

All 141 tests pass.

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

Steake commented Mar 15, 2026

@copilot

This is now in much better shape.

The substantive blockers appear to be addressed:

  • dependency_contract.json has been reconciled with the charter language and Lane 5 semantics
  • find_existing_github_issue() now hard-normalizes unexpected failures into RepoArchitectError
  • label handling now distinguishes requested labels from labels_confirmed returned by the GitHub API
  • generated dry-run/report artifacts have been removed from tracking and gitignored
  • the IssueAction / operator-guide contract has been tightened up
  • test coverage has been expanded around these paths

Assuming the file-level diff matches the PR description, this looks close to mergeable.

One thing I still want kept explicit in code/docs/tests is the distinction between:

  • labels requested by the orchestration layer
  • labels actually confirmed by the GitHub API on create/update

That distinction matters and should remain the source of truth in summaries and artifacts.

Otherwise this now looks aligned with the charter-preserved model:
issue-first by default, mutation modes non-default, and the repo no longer polluted by per-run generated artifacts.

…of) distinction in code, docs, and tests

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

Copilot AI commented Mar 15, 2026

@copilot

This is now in much better shape.
...

Sharpened the labels_applied vs labels_confirmed distinction in 1ecbb4d:

  • IssueAction field comments: labels_applied now reads "labels requested by the orchestration layer"; labels_confirmed reads "labels actually confirmed by GitHub API response; None when no API call was made"
  • OPERATOR_GUIDE table: labels_applied → "Labels requested by the orchestration layer (deterministic set sent to the GitHub API)"; labels_confirmed → "Labels actually confirmed by the GitHub API response after create/update … use this as the source of truth"
  • TestLabelsConfirmed docstring: expanded to document both fields and when each is populated vs None

182 tests pass, CodeQL: 0 alerts.

@Steake
Copy link
Copy Markdown

Steake commented Mar 15, 2026

@copilot

This is now in good shape.

The merge-blocking items appear to be addressed:

  • dependency_contract.json now matches the charter/Lane 5 semantics instead of encoding a misleading direction model
  • find_existing_github_issue() now hard-normalizes unexpected failures into RepoArchitectError
  • labels_confirmed makes the create/update paths report what GitHub actually returned, rather than only what the orchestrator requested
  • generated dry-run/report artifacts are no longer tracked in-tree
  • the IssueAction/operator-guide contract has been tightened up
  • Lane 7 boundary detection now distinguishes same-agent imports from genuine cross-agent violations

Assuming the file-level diff matches the PR description, this looks close to mergeable.

One thing worth keeping explicit in code/docs/tests is the distinction between:

  • labels requested by repo-architect
  • labels actually confirmed by the GitHub API

That distinction should remain the source of truth in summaries, artifacts, and any future automation built on top of issue mode.

Otherwise this now looks aligned with the charter-preserved model:
issue-first by default, mutation modes explicit and non-default, and no per-run generated artifact clutter committed into the repo.

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 shifts repo_architect.py to an issue-first governance workflow (default mode), while reconciling charter-alignment details, tightening error normalization, clarifying label “requested vs confirmed” semantics, and cleaning generated artifacts from version control.

Changes:

  • Added issue-first mode with deterministic issue fingerprinting, structured issue-body rendering, deduplication, and label proof (labels_confirmed) in repo_architect.py.
  • Introduced/updated charter companion artifacts (policy.json, mutation_lanes.json, dependency_contract.json) and expanded operator documentation; removed generated report markdowns from tracking and gitignored run outputs.
  • Updated GitHub workflow inputs/permissions to support issue mode and separated mutation-mode execution; strengthened tests (fail-fast git commands) and added substantial coverage for issue-mode behavior.

Reviewed changes

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

Show a summary per file
File Description
tests/test_repo_architect.py Adds extensive tests for issue-first mode (fingerprints, issue rendering, dedupe, labels_confirmed, lane 5/7 detection) and makes git test setup fail-fast.
repo_architect.py Implements issue-first orchestration (new mode, ArchGap/IssueAction, dedupe, label proof), adds charter constants/companion discovery, improves error normalization, updates summaries, and routes new mode.
docs/repo_architect/OPERATOR_GUIDE.md Rewrites documentation around the new operating model, output schema, label semantics, and charter companion files.
docs/repo_architect/policy.json Adds machine-readable governance policy derived from the implementation charter.
docs/repo_architect/mutation_lanes.json Adds machine-readable lane definitions and mutation budget/validation policy.
docs/repo_architect/dependency_contract.json Adds a machine-readable dependency direction contract aligned with charter §6 and Lane 5 enforcement.
.github/workflows/repo-architect.yml Adds issue-mode inputs, defaults workflow to issue mode, adjusts permissions, and splits issue vs mutate/campaign jobs.
.gitignore Ignores repo-architect dry-run outputs, generated report markdowns, and .agent/ run artifacts.
docs/repo_architect/top_risks.md Removes generated report from tracking (now gitignored).
docs/repo_architect/runtime_inventory.md Removes generated report from tracking (now gitignored).
docs/repo_architect/parse_errors.md Removes generated report from tracking (now gitignored).
docs/repo_architect/entrypoint_clusters.md Removes generated report from tracking (now gitignored).
docs/repo_architect/circular_dependencies.md Removes generated report from tracking (now gitignored).
.agent/roadmap.json Removes generated artifact from tracking (now gitignored).
.agent/code_graph.json Removes generated artifact from tracking (now gitignored).

@@ -0,0 +1,74 @@
{
"$schema": "docs/repo_architect/policy.json",
@@ -0,0 +1,150 @@
{
"$schema": "docs/repo_architect/mutation_lanes.json",
Comment on lines +728 to +732
Returns the matching issue dict, or ``None`` if no match is found.
Raises :class:`RepoArchitectError` for **any** failure during the lookup
(network, HTTP, JSON decode, unexpected response shape, etc.) so that
callers always receive a single normalised exception type and can decide
whether to skip issue creation on dedupe failure.
Comment on lines +1196 to +1200
suggested_files=[
str(config.analysis_path.relative_to(config.git_root)),
str(DEFAULT_REPORT_DIR / "top_risks.md"),
],
implementation_notes=(
campaign_lanes=campaign_lanes,
dry_run=args.dry_run,
max_issues=args.max_issues,
issue_subsystem=args.issue_subsystem or os.environ.get("REPO_ARCHITECT_SUBSYSTEM"),
Comment on lines 38 to 40
@@ -38,8 +39,8 @@ def _make_git_root(tmp: str) -> pathlib.Path:
subprocess.run(["git", "-C", str(root), "config", "user.name", "Test"], capture_output=True)
# Create an initial commit so HEAD exists and branch operations work
@Steake
Copy link
Copy Markdown

Steake commented Mar 15, 2026

@copilot apply changes based on the comments in this thread

Copilot AI and others added 2 commits March 15, 2026 11:26
Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 15, 2026

@copilot apply changes based on the comments in this thread

Implemented all requested updates in a388791 and follow-up test tightening in 81ff51e.

This includes removing self-referential $schema from policy.json and mutation_lanes.json, aligning find_existing_github_issue() docstring with behavior, replacing top_risks.md references in architecture-score gaps with analysis artifact paths, validating REPO_ARCHITECT_SUBSYSTEM env values against SUBSYSTEM_LABELS, and adding check=True to git config subprocess calls in tests. Also added/updated tests to cover the new env validation and architecture-score path/notes behavior.

Copilot AI changed the title fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening Mar 15, 2026
@Steake Steake requested review from Copilot March 15, 2026 11:32
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 pivots repo_architect.py toward an issue-first governance default mode (diagnose → dedupe → open/update GitHub Issues with structured bodies/prompts), while tightening API/error contracts, documenting charter alignment, and cleaning generated artifacts from version control.

Changes:

  • Add issue-mode orchestration (fingerprinting, issue body rendering, dedupe, label proof) and route --mode issue as the default execution path.
  • Harden operational contracts: normalize GitHub/network errors, validate REPO_ARCHITECT_SUBSYSTEM, and expand/verify output schemas via tests.
  • Repository hygiene + documentation/workflow updates: ignore run-generated artifacts, add charter companion JSONs, and update the operator guide/workflow inputs.

Reviewed changes

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

Show a summary per file
File Description
repo_architect.py Introduces issue-first mode, adds dedupe+label-proof plumbing, extends charter constants/context, and adjusts CLI + summaries.
tests/test_repo_architect.py Adds extensive unittest coverage for issue-mode behaviors, schema contracts, helper utilities, and charter alignment.
.github/workflows/repo-architect.yml Updates workflow to default to issue and adds issue-mode inputs; splits mutation modes into a separate job.
docs/repo_architect/OPERATOR_GUIDE.md Rewrites documentation around the new operating model, modes, outputs, and companion files.
docs/repo_architect/policy.json Adds machine-readable policy (modes, invariants, priority order, agent instruction contract).
docs/repo_architect/mutation_lanes.json Adds machine-readable lane definitions + validation/budget policy metadata.
docs/repo_architect/dependency_contract.json Adds machine-readable dependency direction contract and Lane 5 enforcement notes.
.gitignore Ignores .agent/, issue dry-run outputs, and per-run generated markdown reports.
docs/repo_architect/*.md & .agent/*.json Removes run-generated artifacts from tracking (now gitignored).

Comment on lines +895 to +896
log("Deduplication lookup failed; skipping issue creation to avoid duplicates",
data={"fingerprint": fp, "error": str(exc)})
Comment on lines +99 to +105
repo-architect-issue:
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'issue' || github.event.inputs.mode == 'analyze' || github.event.inputs.mode == 'report' || github.event_name == 'schedule' }}
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
models: read
inputs:
mode:
description: 'Execution mode'
description: 'Operating mode. ''issue'' (default safe governance mode). ''analyze''/''report'' are read-only. ''mutate''/''campaign'' are charter-validated secondary modes (§9–§10).'
"agents": "Agent orchestration, lifecycle, message routing",
"interface": "External API surface, protocol handling, presentation"
},
"allowed_direction": "Dependencies flow from outer layers toward inner layers: interface depends-on agents depends-on knowledge depends-on core depends-on runtime. This is a conceptual directional flow per charter §6, not a licence for arbitrary imports. Reverse dependencies (inner layers importing outer layers) violate the contract. See hard_prohibitions for the specific §6.1 enforcement rules.",
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Steake
Copy link
Copy Markdown

Steake commented Mar 15, 2026

@copilot apply changes based on the comments in this thread

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

Copilot AI commented Mar 15, 2026

@copilot apply changes based on the comments in this thread

Implemented the thread updates in 00c9617.

Changes include: propagating json_mode=config.log_json in the dedupe-failure log path, moving report mode to the mutation-capable workflow job with write permissions (and updating the mode description accordingly), and reconciling dependency_contract.json wording so allowed_direction and lane_5_enforcement.not_flagged are internally consistent for tooling.

Added regression coverage for the dedupe lookup failure log-mode behavior in TestIssueSynthesisDeduplication.

No UI changes were made in this update.

Copilot AI changed the title fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening fix: resolve merge-blocking items — charter alignment, exception normalization, label proof, artifact hygiene, API contract accuracy, env-validation hardening, workflow-permission alignment Mar 15, 2026
@Steake Steake merged commit 21a12dc into main Mar 15, 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