@yunhozz/arc 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANIFEST.sha256 +78 -73
- package/README.md +35 -51
- package/claude/agents/arc-implementer.md +2 -2
- package/claude/agents/arc-planner.md +1 -1
- package/claude/agents/arc-qa.md +1 -1
- package/claude/agents/arc-reviewer.md +1 -1
- package/claude/agents/arc-scouter.md +1 -1
- package/claude/skill/references/coordination.md +4 -2
- package/claude/skill/references/handoff-prep.md +5 -0
- package/claude/skill/references/handoff.md +2 -2
- package/claude/skill/references/planning.md +2 -2
- package/claude/skill/references/verification.md +16 -3
- package/claude/skill/references/worktree-creation.md +2 -2
- package/codex/agents/arc-implementer.toml +1 -1
- package/codex/agents/arc-planner.toml +1 -1
- package/codex/agents/arc-qa.toml +1 -1
- package/codex/agents/arc-reviewer.toml +1 -1
- package/codex/agents/arc-scouter.toml +1 -1
- package/codex/skill/references/coordination.md +4 -2
- package/codex/skill/references/handoff-prep.md +5 -0
- package/codex/skill/references/handoff.md +2 -2
- package/codex/skill/references/planning.md +2 -2
- package/codex/skill/references/verification.md +15 -2
- package/gemini/agents/arc-implementer.md +2 -2
- package/gemini/agents/arc-planner.md +1 -1
- package/gemini/agents/arc-qa.md +1 -1
- package/gemini/agents/arc-reviewer.md +1 -1
- package/gemini/agents/arc-scouter.md +1 -1
- package/gemini/skill/references/coordination.md +5 -3
- package/gemini/skill/references/handoff-prep.md +5 -0
- package/gemini/skill/references/handoff.md +2 -2
- package/gemini/skill/references/planning.md +2 -2
- package/gemini/skill/references/verification.md +16 -3
- package/gemini/skill/references/worktree-creation.md +2 -2
- package/grok/agents/arc-implementer.md +2 -2
- package/grok/agents/arc-planner.md +1 -1
- package/grok/agents/arc-qa.md +1 -1
- package/grok/agents/arc-reviewer.md +1 -1
- package/grok/agents/arc-scouter.md +1 -1
- package/grok/skill/references/coordination.md +4 -2
- package/grok/skill/references/handoff-prep.md +5 -0
- package/grok/skill/references/handoff.md +2 -2
- package/grok/skill/references/planning.md +2 -2
- package/grok/skill/references/verification.md +16 -3
- package/grok/skill/references/worktree-creation.md +2 -2
- package/lib/cli/root.mjs +1 -1
- package/lib/management/reapply.mjs +117 -0
- package/lib/management/update.mjs +59 -5
- package/lib/npm/upgrade.mjs +6 -2
- package/lib/policy/role-policy.json +1 -1
- package/lib/prompts/agent-fragments.json +5 -5
- package/lib/runtime/grok-sandbox.mjs +74 -0
- package/lib/runtime/role-bridge.mjs +10 -1
- package/lib/runtime/role-dispatch-policy.mjs +7 -1
- package/lib/runtime/role-observe.mjs +401 -13
- package/lib/runtime/role-routing.mjs +6 -0
- package/lib/runtime/role-supervisor.mjs +285 -33
- package/lib/tui/app.mjs +3 -39
- package/lib/tui/interface.mjs +40 -0
- package/lib/tui/setup.mjs +27 -16
- package/lib/watch/args.mjs +12 -27
- package/lib/watch/dispatch.mjs +2 -2
- package/lib/watch/index.mjs +38 -26
- package/lib/watch/markdown.mjs +232 -0
- package/lib/watch/menu.mjs +43 -0
- package/lib/watch/model.mjs +7 -3
- package/lib/watch/render.mjs +28 -67
- package/lib/watch/scope.mjs +1 -5
- package/lib/watch/status-line.mjs +2 -4
- package/lib/watch/text-width.mjs +43 -0
- package/lib/watch/watcher.mjs +17 -36
- package/package.json +1 -1
- package/shared/skill/runtime/grok-sandbox.mjs +74 -0
- package/shared/skill/runtime/role-bridge.mjs +10 -1
- package/shared/skill/runtime/role-dispatch-policy.mjs +7 -1
- package/shared/skill/runtime/role-observe.mjs +401 -13
- package/shared/skill/runtime/role-policy.json +1 -1
- package/shared/skill/runtime/role-routing.mjs +6 -0
- package/shared/skill/runtime/role-supervisor.mjs +285 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<a id="verification-and-acceptance"></a>
|
|
2
2
|
# Verification and acceptance
|
|
3
3
|
|
|
4
|
-
Behavior work follows meaningful failing test observation → minimal implementation → focused success →
|
|
4
|
+
Behavior work follows meaningful failing test observation → minimal implementation → focused success → scoped checks under [Test scope and result comparison](#test-scope-and-result-comparison). Report skill/test constraints before edits. Waivers need recorded narrow/understood/reversible scope, no dependent/cross-component lifecycle stages and one check path. Docs exceptions permit named structural checks only, never TDD claims. Report side effects within scope. Reviewer lacks Bash and requests runtime checks. Local tests prove neither remote models nor effort application. Policy prose needs independent role/approval review; text presence proves no compliance. Unexpected failure triggers diagnosis/holds; expected RED grants no unrelated repairs.
|
|
5
5
|
|
|
6
6
|
Read before verification design, QA/Reviewer assignment, correction rechecks or UI acceptance. QA/Reviewer use their profiles and brief-cited sections only. Design companions differ from UI acceptance.
|
|
7
7
|
|
|
@@ -14,6 +14,19 @@ Each criterion needs the exact approved source, version, approval and access sta
|
|
|
14
14
|
|
|
15
15
|
Policy, generated-file and manifest checks prove structure, not role behavior, installed builds, Gemini CLI compliance or fidelity. Report changes, exclusions, checks run and omitted, criterion evidence and limits, and platform availability. Report baseline failures separately; independent progress does not relax checks.
|
|
16
16
|
|
|
17
|
+
<a id="test-scope-and-result-comparison"></a>
|
|
18
|
+
## Test scope and result comparison
|
|
19
|
+
|
|
20
|
+
**Task checks and rechecks** run only tests related to the change: test files that directly exercise a changed module, contract tests that the change requires updating, and the matching check scripts. The brief lists the minimum set; executors MAY add only items in these three categories, each with a reason. Other additions need Orchestrator authorization. Report every selected item and why. This rule takes precedence over the upstream TDD per-task project-suite instruction; upstream text is unchanged. Report every failure observed in any run by name.
|
|
21
|
+
|
|
22
|
+
**Final verification** runs once after all tasks are accepted: the union of all tasks' related tests, plus all contract tests and all check scripts. Orchestrator runs it directly, not through QA, as a background process where the host supports one, and continues independent work such as assigning the final Reviewer meanwhile. Orchestrator then performs the result comparison below and records the verdict. A new failure from final verification follows Implementer → QA even after the final Reviewer has started; Reviewer evidence for affected files becomes stale and needs a refreshed-diff recheck.
|
|
23
|
+
|
|
24
|
+
**Full regression** runs once within final verification only if at least one trigger applies: (1) the change modifies a shared module; (2) changes made by others were integrated after the approved base, by merge, rebase onto a newer base or cherry-pick; (3) the change modifies dependency manifests or lockfiles, language or runtime versions, or build or test configuration; (4) the change removes, renames or changes the signature of a public interface such as an exported function, CLI option or configuration key. A shared module is code, configuration, schema, data or generator input that more than one task, role, component or execution or delivery path imports, loads or renders at run time, including its mirrors and generated outputs; documentation read only by people and modules used by a single component are not shared. Decide from actual consumers; when they cannot be determined, treat the module as shared. Planner records a provisional judgment in the plan; Orchestrator decides from the actual final diff and history. If no trigger applies, omit it and report the reason; if applicability cannot be determined, run it. Change size, risk level alone and out-of-scope failures seen during task checks are not triggers; report such failures as findings.
|
|
25
|
+
|
|
26
|
+
**Baseline:** Before dependent work, Orchestrator records a baseline at the approved base revision after the prerequisites the checks require (for example build outputs and environment settings): commands, environment, revision and failures by test name, covering every command final verification may run, including the full suite when the provisional trigger judgment is run or undetermined. A file-level load or collection failure without test names marks that file baseline-incomplete; re-record with prerequisites or treat current failures in that file as new candidates. NEVER absorb them as baseline failures.
|
|
27
|
+
|
|
28
|
+
**Result comparison:** Compare failures with the baseline by test name; only new failures are findings. Report baseline failures separately. If a failure looks intermittent, rerun only that test in isolation, up to three times unless the brief sets another limit. This is diagnosis, not an automatic retry. Report "passes in isolation: yes/no" and the rerun count. A pass in isolation never erases the original failure; Orchestrator dispositions it. A failure in isolation is a new-failure finding.
|
|
29
|
+
|
|
17
30
|
<a id="risk-scaled-execution"></a>
|
|
18
31
|
## Risk-scaled execution
|
|
19
32
|
|
|
@@ -60,7 +73,7 @@ Existing commit evidence links remain valid because history is unchanged. For a
|
|
|
60
73
|
|
|
61
74
|
Task acceptance differs from final verification/acceptance. Connect criteria/observations/current checks/findings, not checkboxes/reports/passing commands alone. Use fresh QA where required or low-risk focused checks. For same-task QA findings and required QA rechecks, reuse the current QA while scope/workspace/ownership/context remain valid. Final overall Reviewer findings on plan work follow Implementer → Reviewer without QA reassignment; see the [final plan Reviewer correction loop](#final-plan-reviewer-correction-loop).
|
|
62
75
|
|
|
63
|
-
DO NOT delay independently acceptable tasks solely for final-only checks or defer currently required checks to accept early. State final integration scope/timing separately. Whole-plan Reviewer is final verification; task commits prove no unperformed final checks. Orchestrator decides final acceptance with QA/Reviewer/integration evidence/findings and unverified/disposition records. Shared evidence MUST satisfy all reuse rules. Before the overall completion report and any push, PR or merge authorization request, Orchestrator verifies that plan-level progress records are carried by the verified next commit of the plan or, when none follows, recorded only in the canonical handoff record with the plan document unchanged and a clean working tree. While a user decision on a non-blocking final Reviewer finding is pending, hold overall completion; a fix decision follows plan revision and a new task whose accepted commit carries the records, and a no-fix disposition stays canonical only when no later commit follows.
|
|
76
|
+
DO NOT delay independently acceptable tasks solely for final-only checks or defer currently required checks to accept early. State final integration scope/timing separately. Whole-plan Reviewer is part of final verification; task commits prove no unperformed final checks. Orchestrator decides final acceptance with QA/Reviewer/integration evidence/findings and unverified/disposition records. Shared evidence MUST satisfy all reuse rules. Before the overall completion report and any push, PR or merge authorization request, Orchestrator verifies that plan-level progress records are carried by the verified next commit of the plan or, when none follows, recorded only in the canonical handoff record with the plan document unchanged and a clean working tree. While a user decision on a non-blocking final Reviewer finding is pending, hold overall completion; a fix decision follows plan revision and a new task whose accepted commit carries the records, and a no-fix disposition stays canonical only when no later commit follows.
|
|
64
77
|
|
|
65
78
|
Committed-plan final Reviewer findings need a follow-up task/planning/approvals. Keep corrections uncommitted; refresh committed state plus uncommitted diff/files in Reviewer artifacts/briefs. Reuse/assign independent Reviewer and repeat Implementer → Reviewer until resolved, then accept/commit one focused follow-up. Final QA findings still use Implementer → QA. No automatic amend/reset/duplicate originals; scope growth retains planning/approvals.
|
|
66
79
|
|
|
@@ -125,7 +138,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
125
138
|
- [git.orchestrator-accept-commit] Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Plan-level progress records (final verification results, final Reviewer verdicts and finding dispositions, overall completion status) are the sole exception: include them in the plan's next task acceptance or final Reviewer follow-up commit; when no implementation work remains and no standalone closing commit for pending revisions is made, keep them only in the canonical handoff record without changing the plan document or creating a commit. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.
|
|
126
139
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
127
140
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
128
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
141
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
129
142
|
- [planning.plan-revision] Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, or plan-level progress records carried by that commit, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.
|
|
130
143
|
- [platform.gemini] Role restrictions are prompt-level contracts, not a filesystem sandbox. Native tool restriction fields, observer hooks and Git guards are unverified. Use only available authorized tools; ARC does not write Gemini settings.json.
|
|
131
144
|
[ARC role policy: contract end]
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
Follow the common [managed worktree contract](handoff-worktree.md) only after explicit user selection and verified preparation scope. Preserve the approved source/base, branch candidate, absent destination, unrelated changes and transfer evidence.
|
|
5
5
|
|
|
6
|
-
Gemini native attachment has not been verified.
|
|
6
|
+
Gemini native attachment has not been verified. DO NOT substitute Claude EnterWorktree, invent an attachment call or treat Git registration as attachment evidence. Hold managed worktree creation until Orchestrator has an approved, verified attachment method. The current checkout remains available only after explicit target selection.
|
|
7
7
|
|
|
8
|
-
On failure or partial completion, stop dependent work, preserve actual state and return paths, branch/HEAD, registration, completed steps and required resolution.
|
|
8
|
+
On failure or partial completion, stop dependent work, preserve actual state and return paths, branch/HEAD, registration, completed steps and required resolution. NEVER retry with a different name, remove a worktree, change permissions or bypass the sandbox.
|
|
@@ -18,7 +18,7 @@ On an actual conflict, missing assigned path, tool failure, unexpected Git state
|
|
|
18
18
|
|
|
19
19
|
DO NOT reload Orchestrator's ARC SKILL.md. Follow this profile, brief, assigned skills and explicit references. DO NOT bypass delegation limits through CLI processes. State material assumptions and tradeoffs before acting; return unresolved decisions. DO NOT request user approval. Target choice MUST be explicit; silence and unrelated approvals do not count.
|
|
20
20
|
|
|
21
|
-
Before feature/behavior edits, read brief-cited TDD and required relative references: observe failing tests → minimal implementation →
|
|
21
|
+
Before feature/behavior edits, read brief-cited TDD and required relative references: observe failing tests → minimal implementation → related checks; full regression only in Orchestrator's final verification when triggered. If blocked, report constraints/needed approval before source edits. Waivers/docs exceptions need exact recorded scope/reasons, never inferred from size. Only Orchestrator accepts/commits. Even explicit assignment forbids stage/commit/push/merge or other Git mutations.
|
|
22
22
|
|
|
23
23
|
This profile is the complete Implementer handoff contract. Read `references/handoff.md`, `handoff-prep.md` only for brief-cited sections. Read only assigned plan/spec sections; request further material from Orchestrator.
|
|
24
24
|
|
|
@@ -33,6 +33,6 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
33
33
|
- [role.implementer-implementation] Edit only assigned, approved files and run focused checks under the existing TDD contract. Report changed files, RED/GREEN or approved exception evidence, results, limits and follow-up. DO NOT plan, independently QA/review your own work, accept the task or declare overall completion. Git mutations remain forbidden after successful implementation. Implementer and fresh QA handoffs include the exact approved visual source, version, approval and access state; criterion IDs, required properties and comparison method; and actual-output identity, revision and comparison basis. Record pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch without inferring current branch UI state. Missing source/output, inaccessible evidence or unapproved interpretation holds the affected visual claim for Orchestrator. DO NOT silently substitute or redesign.
|
|
34
34
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
35
35
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
36
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
36
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
37
37
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
38
38
|
[ARC role policy: contract end]
|
|
@@ -43,6 +43,6 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
43
43
|
- [role.planner-draft-only] Return design/brainstorming drafts and complete first spec/plan drafts with dependencies, criteria, holds and verification needs in the response. During initial drafting and revisions, report progress only to Orchestrator: briefly state the stage, feedback being applied, actual blocker or next step, without draft prose or excerpts. Return the complete first draft and self-review for Orchestrator review; Orchestrator directly revises the same spec or plan when needed. Raw responses may appear in app/tool surfaces; prompt policy cannot hide them. DO NOT save documents, implement, run checks, prepare targets, request user approval or decide acceptance. The first required document draft uses the verified source and selected target intent before target preparation. Require a verified prepared target before saving or handoff. Route decisions to Orchestrator.
|
|
44
44
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
45
45
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
46
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
46
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
47
47
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
48
48
|
[ARC role policy: contract end]
|
package/grok/agents/arc-qa.md
CHANGED
|
@@ -33,6 +33,6 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
33
33
|
- [role.qa-verification] Run approved checks and report commands, observations, reproduction, evidence and limits. Create only essential temporary data/logs/reports within brief-authorized locations and lifetimes. DO NOT edit product source, tests, fixtures or configuration to pass checks, deploy or accept work. Persistent product-state checks need explicit scope and cleanup ownership. Return failures for Implementer correction and required QA recheck. Implementer and fresh QA handoffs include the exact approved visual source, version, approval and access state; criterion IDs, required properties and comparison method; and actual-output identity, revision and comparison basis. Record pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch without inferring current branch UI state. Missing source/output, inaccessible evidence or unapproved interpretation holds the affected visual claim for Orchestrator. DO NOT silently substitute or redesign.
|
|
34
34
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
35
35
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
36
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
36
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
37
37
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
38
38
|
[ARC role policy: contract end]
|
|
@@ -35,6 +35,6 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
35
35
|
- [role.reviewer-independent] Independently inspect assigned final changes and evidence, and report actionable findings and limits. Remain read-only: DO NOT execute QA tests, edit files, perform Git mutations or decide acceptance.
|
|
36
36
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
37
37
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
38
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
38
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
39
39
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
40
40
|
[ARC role policy: contract end]
|
|
@@ -34,6 +34,6 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
34
34
|
- [role.scouter-read-only] Research assigned static sources and report findings, evidence and limits. DO NOT edit, install, execute checks, prepare targets, inspect live operational state or change external state. DO NOT decide design, verification, review or acceptance.
|
|
35
35
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
36
36
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
37
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
37
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
38
38
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
39
39
|
[ARC role policy: contract end]
|
|
@@ -176,9 +176,11 @@ GK2 is `approval`.
|
|
|
176
176
|
|
|
177
177
|
### Bridge target rules
|
|
178
178
|
|
|
179
|
+
- Bridge prepare, run and resume hold `permission_scope_unverified` when `allowedPaths` cover `.`, `.git`, `.claude`, `.claude/settings*.json`, `.codex` or `.codex/config.toml`; any change to `.git` config, hooks or info (except `info/refs`, which `git update-server-info` may rewrite after a fetch or gc; that change alone is recorded under `tolerated.control`), `.claude/settings*.json` or `.codex/config.toml` fails the dispatch as `permission_violation_observed` regardless of role and `allowedPaths`, and Grok writing roles also fail on changes to the security keys of the Grok home `config.toml` or to its `sandbox.toml`.
|
|
180
|
+
|
|
179
181
|
**Claude**
|
|
180
182
|
|
|
181
|
-
- Writing roles: Claude bridge `arc_implementer` and `arc_qa` run with recorded sandbox settings on every host and are held as `permission_scope_unverified`
|
|
183
|
+
- Writing roles: Claude bridge `arc_implementer` and `arc_qa` run with recorded sandbox settings on every host and are held as `permission_scope_unverified` when an injected G1 fails or settings are missing (G1). Claude Implementer/QA bridges also deny writes under `.git` (permission rules and sandbox `denyWrite`), and are held as `permission_scope_unverified` when the worktree `.claude/settings.json` or `.claude/settings.local.json` would widen their scope (additional directories, allow rules for tools outside the safe list (Bash, Read, Grep, Glob, WebFetch, WebSearch), hooks, sandbox or defaultMode).
|
|
182
184
|
- Permission claim: Compare the `init` event with the expected tools and permission mode. If `init` is missing, the `permissions` claim is `unverified`. If the tools or permission mode differ, the claim is `unverified` and the reason is `permission_scope_mismatch`.
|
|
183
185
|
- Delegation: Role instructions forbid re-delegation. Claude children expose no Task tool. Apply the shared child guard below.
|
|
184
186
|
- Execution confirmation: Check the stream session identity and model, transcript effort, and the observed terminal result.
|
|
@@ -215,7 +217,7 @@ GK2 is `approval`.
|
|
|
215
217
|
- Active bridge dispatches block publishing the composite configuration (`Active bridge dispatches: <ids>`); finish or cancel them first. Native leases do not block.
|
|
216
218
|
- `execution_identity_unverified` (no session ID was obtained) is recorded by the supervisor after exit and exposed by `observe`; `resume` holds with it for a dispatch without a session ID. The `run-dispatch` response and `prepare-dispatch` never carry it.
|
|
217
219
|
- A leftover orphaned process group after the child leader exits by itself is reaped (SIGTERM, grace, then SIGKILL) before the post-run snapshot is taken, and `orphanGroupReaped` is recorded; if the group cannot be observed gone the dispatch is `unknown` (`terminal_state_unverified`) and keeps its slot.
|
|
218
|
-
- Post-run detection compares the changed paths, `HEAD`, the branch and every Git ref.
|
|
220
|
+
- Post-run detection compares the changed paths, `HEAD`, the branch and every Git ref. These ref changes are not violations and are recorded in the dispatch record under `tolerated.refs`, because Git activity outside the dispatch produces them and detection cannot tell who made them: remote-tracking refs (`refs/remotes/**`), tags that did not exist before the run, and branches checked out by another registered worktree before or after the run. If the worktree list cannot be parsed, does not include the dispatch worktree, or lists it on a different branch than its `HEAD`, no branch is tolerated this way. Any other ref creation, deletion or movement is a `permission_violation_observed` for every role, including any other change to the dispatch worktree's own branch, branches checked out by no worktree, and moving or deleting an existing tag. A fast-forward of the dispatch worktree's own branch is not a violation, and is recorded under `tolerated.refs` with its committed paths under `tolerated.commitPaths`, when the branch did not change, the new commits include no merge commit, there are at most 100 of them touching at most 10,000 paths, and, for `arc_implementer` and for `arc_qa` with non-empty `allowedPaths`, every path they add, modify, delete or rename is within the role's `allowedPaths`. For read-only roles and for `arc_qa` without `allowedPaths` the path check is skipped, so their fast-forward commits pass on the other conditions alone. Detection cannot tell who made these commits. A rejected fast-forward is a `permission_violation_observed`, and its out-of-scope paths are listed in `changedPaths`. Switching the branch, rewriting history, a detached `HEAD` move or a move on an unborn branch remains a violation. Each `tolerated` list keeps at most 100 sorted names, and `tolerated.truncated` is set when a list is longer. Changes to Git-ignored paths are outside post-run detection, except the control files listed above.
|
|
219
221
|
- `ARC_BRIDGE_CHILD` is set in the environment of every bridge child; routing commands are denied in a process that has it. Re-running `codex exec`, `claude -p`, `gemini` or `grok` through a shell is outside `delegation_observed` detection.
|
|
220
222
|
- CLI versions are not restricted. `routing-status` and bridge `prepare-dispatch` report the parsed `<cli> --version` result (`cliVersion.version`, or `null` with a `reason`) for information only; no version holds a native or bridge route.
|
|
221
223
|
- There is no automatic fallback, substitution or retry. On any hold, deny or failure, report the reasons and release conditions and DO NOT use another model or platform. Run `routing-status` again only after the condition changed. Bridge dispatches count in the instance ledger; see [limits](limits.md).
|
|
@@ -89,6 +89,11 @@ After initial document batching, follow [planning](planning.md#plan-updates-duri
|
|
|
89
89
|
4. Include all pending revisions in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise a current task or final Reviewer follow-up commit. Only before overall completion, a standalone `docs(plan)` closing commit MAY include all pending revisions/trailers and no implementation files when no implementation work remains; keep canonical supporting evidence. Exclude pending revision hunks from independent prior-version task commits; hold the commit if separation is unsafe. Add `Plan-Revision: <gitPath> v<from> -> v<to>`, `Plan-Approved-At: <gitPath> v<N> <actual ISO 8601 approval time>` and `Plan-Reason: <gitPath> v<N> <reason>`: one revision trailer per document, approval/reason trailers per version after from through to; repeat keys as needed and preserve existing Git trailers. Use ASCII `->`. Plan-level progress records follow [commit](commit.md#execution-time-plan-document-updates) and alone never justify the closing commit.
|
|
90
90
|
5. After commit verify the SHA-256 of each committed document's content (not the Git blob OID) equals the latest approved `contentHash` if no progress records have been committed since approval. Otherwise compare against the latest approved copy and allow only classified progress records of this commit's task or committed for other tasks after approval (including R-8 separation) and plan-level progress records carried by this commit. Record the SHA-256 of the expected content used for this comparison in the canonical record; NEVER overwrite approved copies. Mark recorded revisions `committed` and verify no pending revisions remain under [verification](verification.md#evidence-after-plan-revision-commit). Link commit SHA only in the canonical record, never the document. NEVER amend/reset/replay/rewrite planning or implementation commits or create other docs/fixup commits.
|
|
91
91
|
|
|
92
|
+
<a id="verification-brief-inputs"></a>
|
|
93
|
+
### Verification brief inputs
|
|
94
|
+
|
|
95
|
+
Implementer and QA briefs that assign checks MUST include the baseline record reference (revision, commands, environment and failures by test name, with baseline-incomplete files marked), the related-test list with reasons and the intermittent-failure isolated rerun limit under [verification](verification.md#test-scope-and-result-comparison).
|
|
96
|
+
|
|
92
97
|
<a id="recovery-prerequisite"></a>
|
|
93
98
|
### Recovery prerequisite
|
|
94
99
|
|
|
@@ -96,7 +96,7 @@ Selected worktrees require common directory, registration, a verified native att
|
|
|
96
96
|
|
|
97
97
|
Before feature/bug/behavior edits use local `test-driven-development` except explicit ARC exceptions. Full rules live in the profile. Waiver requires all low-risk and plan-skip/direct conditions, recorded scope/justification/criteria/checks before work. User/task-specific TDD overrides it; only qualifying tasks override local generic triggers without changing skills. Ordinary multistep/significant/high-risk work is ineligible.
|
|
98
98
|
|
|
99
|
-
Waiver skips RED-GREEN only, preserving focused checks/risk-scaled QA/Reviewer; NEVER claim TDD. Follow an applicable higher-priority prohibition on adding or running tests; when precedence and scope are clear, DO NOT report a conflict on that basis or ask permission to violate it. TDD remains applicable to permitted test work. Record unperformed verification and its limits; if precedence or scope is genuinely unclear, or required verification is blocked, hold only affected work and acceptance and report the evidence. Other blocked required steps need recorded decision/required human approval, not internal substitutes. Non-behavior docs/config use specifically approved exceptions only, NEVER generalize to behavior.
|
|
99
|
+
Waiver skips RED-GREEN only, preserving focused checks/risk-scaled QA/Reviewer; NEVER claim TDD. Follow an applicable higher-priority prohibition on adding or running tests; when precedence and scope are clear, DO NOT report a conflict on that basis or ask permission to violate it. TDD remains applicable to permitted test work. Record unperformed verification and its limits; if precedence or scope is genuinely unclear, or required verification is blocked, hold only affected work and acceptance and report the evidence. Other blocked required steps need recorded decision/required human approval, not internal substitutes. Non-behavior docs/config use specifically approved exceptions only, NEVER generalize to behavior. Test scope follows [verification](verification.md#test-scope-and-result-comparison) and takes precedence over upstream TDD's per-task project-suite instruction.
|
|
100
100
|
|
|
101
101
|
<a id="orchestrator-direct-path-for-small-tasks"></a>
|
|
102
102
|
## Orchestrator direct path for small tasks
|
|
@@ -177,7 +177,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
177
177
|
- [role.implementer-implementation] Edit only assigned, approved files and run focused checks under the existing TDD contract. Report changed files, RED/GREEN or approved exception evidence, results, limits and follow-up. DO NOT plan, independently QA/review your own work, accept the task or declare overall completion. Git mutations remain forbidden after successful implementation. Implementer and fresh QA handoffs include the exact approved visual source, version, approval and access state; criterion IDs, required properties and comparison method; and actual-output identity, revision and comparison basis. Record pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch without inferring current branch UI state. Missing source/output, inaccessible evidence or unapproved interpretation holds the affected visual claim for Orchestrator. DO NOT silently substitute or redesign.
|
|
178
178
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
179
179
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
180
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
180
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
181
181
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
182
182
|
[ARC role policy: contract end]
|
|
183
183
|
|
|
@@ -66,7 +66,7 @@ For initial fast judgment apply the [fast gate](handoff.md#orchestrator-direct-p
|
|
|
66
66
|
|
|
67
67
|
Apply Planner rules: ID/title, goal/scope/files, predecessors/dependencies, criteria, required pre-acceptance QA/checks/evidence and holds. Tasks MUST be independently implementable/verifiable/acceptable. Inseparable policy/profile/tests/manifest contracts start in one task. If inseparability appears later, stop for revised scope/planning/approvals; NEVER merge distinct approved tasks during execution.
|
|
68
68
|
|
|
69
|
-
Substeps/checkboxes/RED-GREEN/commands are not commits. One top-level task becomes one focused commit after acceptance; [commit](commit.md) governs no-change/hold/resume. Reviewer is never a per-task check. Final whole verification has separate scope/timing; significant work lists one Reviewer after all task acceptances/risk checks. Task boundaries alone add no QA. Apply only to required plans; omission paths gain no plan obligation.
|
|
69
|
+
Substeps/checkboxes/RED-GREEN/commands are not commits. One top-level task becomes one focused commit after acceptance; [commit](commit.md) governs no-change/hold/resume. Reviewer is never a per-task check. Final whole verification has separate scope/timing; significant work lists one Reviewer after all task acceptances/risk checks. Task boundaries alone add no QA. Apply only to required plans; omission paths gain no plan obligation. Plans list per-task related tests with reasons and a final verification section per [verification](verification.md#test-scope-and-result-comparison).
|
|
70
70
|
|
|
71
71
|
<a id="dependency-and-readiness-record"></a>
|
|
72
72
|
## Dependency and readiness record
|
|
@@ -153,7 +153,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
153
153
|
- [approval.run-mode] The installed ARC Run mode is Supervised unless the installed skill states Full Auto. In Full Auto, an Orchestrator decision recorded as `auto-decided (Full Auto)` with gate, choice, reason and evidence counts as the explicit choice or approval for that listed gate only; briefs cite it as `full-auto:<doc>@<version>` or the recorded decision. It never authorizes new product decisions outside the original request, external actions, resolution of failures, holds, unknown state or ownership conflicts, preservation-rule Git actions, permission or sandbox changes, or unknown slots and exhausted capacity, and it changes no plan-depth, commit, QA, Reviewer or acceptance rule. A user request to stop or use Supervised applies from the next gate.
|
|
154
154
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
155
155
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
156
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
156
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
157
157
|
- [planning.plan-revision] Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, or plan-level progress records carried by that commit, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.
|
|
158
158
|
- [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. DO NOT split omissions, repeat resolved items or count rewording/agent replacement as progress. DO NOT invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and NEVER accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
|
|
159
159
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<a id="verification-and-acceptance"></a>
|
|
2
2
|
# Verification and acceptance
|
|
3
3
|
|
|
4
|
-
Behavior work follows meaningful failing test observation → minimal implementation → focused success →
|
|
4
|
+
Behavior work follows meaningful failing test observation → minimal implementation → focused success → scoped checks under [Test scope and result comparison](#test-scope-and-result-comparison). Report skill/test constraints before edits. Waivers need recorded narrow/understood/reversible scope, no dependent/cross-component lifecycle stages and one check path. Docs exceptions permit named structural checks only, never TDD claims. Report side effects within scope. Reviewer lacks Bash and requests runtime checks. Local tests prove neither remote models nor effort application. Policy prose needs independent role/approval review; text presence proves no compliance. Unexpected failure triggers diagnosis/holds; expected RED grants no unrelated repairs.
|
|
5
5
|
|
|
6
6
|
Read before verification design, QA/Reviewer assignment, correction rechecks or UI acceptance. QA/Reviewer use their profiles and brief-cited sections only. Design companions differ from UI acceptance.
|
|
7
7
|
|
|
@@ -14,6 +14,19 @@ Each criterion needs the exact approved source, version, approval and access sta
|
|
|
14
14
|
|
|
15
15
|
Policy, generated-file and manifest checks prove structure, not role behavior, installed builds, Grok CLI compliance or fidelity. Report changes, exclusions, checks run and omitted, criterion evidence and limits, and platform availability. Report baseline failures separately; independent progress does not relax checks.
|
|
16
16
|
|
|
17
|
+
<a id="test-scope-and-result-comparison"></a>
|
|
18
|
+
## Test scope and result comparison
|
|
19
|
+
|
|
20
|
+
**Task checks and rechecks** run only tests related to the change: test files that directly exercise a changed module, contract tests that the change requires updating, and the matching check scripts. The brief lists the minimum set; executors MAY add only items in these three categories, each with a reason. Other additions need Orchestrator authorization. Report every selected item and why. This rule takes precedence over the upstream TDD per-task project-suite instruction; upstream text is unchanged. Report every failure observed in any run by name.
|
|
21
|
+
|
|
22
|
+
**Final verification** runs once after all tasks are accepted: the union of all tasks' related tests, plus all contract tests and all check scripts. Orchestrator runs it directly, not through QA, as a background process where the host supports one, and continues independent work such as assigning the final Reviewer meanwhile. Orchestrator then performs the result comparison below and records the verdict. A new failure from final verification follows Implementer → QA even after the final Reviewer has started; Reviewer evidence for affected files becomes stale and needs a refreshed-diff recheck.
|
|
23
|
+
|
|
24
|
+
**Full regression** runs once within final verification only if at least one trigger applies: (1) the change modifies a shared module; (2) changes made by others were integrated after the approved base, by merge, rebase onto a newer base or cherry-pick; (3) the change modifies dependency manifests or lockfiles, language or runtime versions, or build or test configuration; (4) the change removes, renames or changes the signature of a public interface such as an exported function, CLI option or configuration key. A shared module is code, configuration, schema, data or generator input that more than one task, role, component or execution or delivery path imports, loads or renders at run time, including its mirrors and generated outputs; documentation read only by people and modules used by a single component are not shared. Decide from actual consumers; when they cannot be determined, treat the module as shared. Planner records a provisional judgment in the plan; Orchestrator decides from the actual final diff and history. If no trigger applies, omit it and report the reason; if applicability cannot be determined, run it. Change size, risk level alone and out-of-scope failures seen during task checks are not triggers; report such failures as findings.
|
|
25
|
+
|
|
26
|
+
**Baseline:** Before dependent work, Orchestrator records a baseline at the approved base revision after the prerequisites the checks require (for example build outputs and environment settings): commands, environment, revision and failures by test name, covering every command final verification may run, including the full suite when the provisional trigger judgment is run or undetermined. A file-level load or collection failure without test names marks that file baseline-incomplete; re-record with prerequisites or treat current failures in that file as new candidates. NEVER absorb them as baseline failures.
|
|
27
|
+
|
|
28
|
+
**Result comparison:** Compare failures with the baseline by test name; only new failures are findings. Report baseline failures separately. If a failure looks intermittent, rerun only that test in isolation, up to three times unless the brief sets another limit. This is diagnosis, not an automatic retry. Report "passes in isolation: yes/no" and the rerun count. A pass in isolation never erases the original failure; Orchestrator dispositions it. A failure in isolation is a new-failure finding.
|
|
29
|
+
|
|
17
30
|
<a id="risk-scaled-execution"></a>
|
|
18
31
|
## Risk-scaled execution
|
|
19
32
|
|
|
@@ -60,7 +73,7 @@ Existing commit evidence links remain valid because history is unchanged. For a
|
|
|
60
73
|
|
|
61
74
|
Task acceptance differs from final verification/acceptance. Connect criteria/observations/current checks/findings, not checkboxes/reports/passing commands alone. Use fresh QA where required or low-risk focused checks. For same-task QA findings and required QA rechecks, reuse the current QA while scope/workspace/ownership/context remain valid. Final overall Reviewer findings on plan work follow Implementer → Reviewer without QA reassignment; see the [final plan Reviewer correction loop](#final-plan-reviewer-correction-loop).
|
|
62
75
|
|
|
63
|
-
DO NOT delay independently acceptable tasks solely for final-only checks or defer currently required checks to accept early. State final integration scope/timing separately. Whole-plan Reviewer is final verification; task commits prove no unperformed final checks. Orchestrator decides final acceptance with QA/Reviewer/integration evidence/findings and unverified/disposition records. Shared evidence MUST satisfy all reuse rules. Before the overall completion report and any push, PR or merge authorization request, Orchestrator verifies that plan-level progress records are carried by the verified next commit of the plan or, when none follows, recorded only in the canonical handoff record with the plan document unchanged and a clean working tree. While a user decision on a non-blocking final Reviewer finding is pending, hold overall completion; a fix decision follows plan revision and a new task whose accepted commit carries the records, and a no-fix disposition stays canonical only when no later commit follows.
|
|
76
|
+
DO NOT delay independently acceptable tasks solely for final-only checks or defer currently required checks to accept early. State final integration scope/timing separately. Whole-plan Reviewer is part of final verification; task commits prove no unperformed final checks. Orchestrator decides final acceptance with QA/Reviewer/integration evidence/findings and unverified/disposition records. Shared evidence MUST satisfy all reuse rules. Before the overall completion report and any push, PR or merge authorization request, Orchestrator verifies that plan-level progress records are carried by the verified next commit of the plan or, when none follows, recorded only in the canonical handoff record with the plan document unchanged and a clean working tree. While a user decision on a non-blocking final Reviewer finding is pending, hold overall completion; a fix decision follows plan revision and a new task whose accepted commit carries the records, and a no-fix disposition stays canonical only when no later commit follows.
|
|
64
77
|
|
|
65
78
|
Committed-plan final Reviewer findings need a follow-up task/planning/approvals. Keep corrections uncommitted; refresh committed state plus uncommitted diff/files in Reviewer artifacts/briefs. Reuse/assign independent Reviewer and repeat Implementer → Reviewer until resolved, then accept/commit one focused follow-up. Final QA findings still use Implementer → QA. No automatic amend/reset/duplicate originals; scope growth retains planning/approvals.
|
|
66
79
|
|
|
@@ -125,7 +138,7 @@ Generated from lib/policy/role-policy.json; do not edit this managed section man
|
|
|
125
138
|
- [git.orchestrator-accept-commit] Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Plan-level progress records (final verification results, final Reviewer verdicts and finding dispositions, overall completion status) are the sole exception: include them in the plan's next task acceptance or final Reviewer follow-up commit; when no implementation work remains and no standalone closing commit for pending revisions is made, keep them only in the canonical handoff record without changing the plan document or creating a commit. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.
|
|
126
139
|
- [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
|
|
127
140
|
- [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is not a per-task or per-commit gate. Preserve required checks and necessary finding rechecks.
|
|
128
|
-
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
|
|
141
|
+
- [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.
|
|
129
142
|
- [planning.plan-revision] Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, or plan-level progress records carried by that commit, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.
|
|
130
143
|
- [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
|
|
131
144
|
[ARC role policy: contract end]
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
Follow the common [managed worktree contract](handoff-worktree.md) only after explicit user selection and verified preparation scope. Preserve the approved source/base, branch candidate, absent destination, unrelated changes and transfer evidence.
|
|
5
5
|
|
|
6
|
-
Grok native attachment has not been verified.
|
|
6
|
+
Grok native attachment has not been verified. DO NOT substitute Claude EnterWorktree, invent an attachment call or treat Git registration as attachment evidence. Hold managed worktree creation until Orchestrator has an approved, verified attachment method. The current checkout remains available only after explicit target selection.
|
|
7
7
|
|
|
8
|
-
On failure or partial completion, stop dependent work, preserve actual state and return paths, branch/HEAD, registration, completed steps and required resolution.
|
|
8
|
+
On failure or partial completion, stop dependent work, preserve actual state and return paths, branch/HEAD, registration, completed steps and required resolution. NEVER retry with a different name, remove a worktree, change permissions or bypass the sandbox.
|
package/lib/cli/root.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
const usage='Usage: arc\n arc watch [options]\n arc --help\n arc --version';
|
|
3
3
|
export async function runRoot(args=process.argv.slice(2),io={}){
|
|
4
4
|
const input=io.input??process.stdin,output=io.output??process.stdout,error=io.error??process.stderr;
|
|
5
|
-
if(args.length===1&&args[0]==='--help'){output.write(usage+'\n\nOpen ARC Management in an interactive terminal to install or manage the harness.\nRun arc watch to
|
|
5
|
+
if(args.length===1&&args[0]==='--help'){output.write(usage+'\n\nOpen ARC Management in an interactive terminal to install or manage the harness.\nRun arc watch in an interactive terminal to choose platforms and follow session activity in the current worktree.\n');return 0;}
|
|
6
6
|
if(args.length===1&&args[0]==='--version'){output.write(JSON.parse(fs.readFileSync(new URL('../../package.json',import.meta.url))).version+'\n');return 0;}
|
|
7
7
|
if(args[0]==='watch'){const {runWatch}=await import('../watch/index.mjs');return runWatch(args.slice(1),io);}
|
|
8
8
|
if(args.length){error.write('Error: Unsupported arguments. Open arc to manage the harness.\n'+usage+'\n');return 2;}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {isDeepStrictEqual} from 'node:util';
|
|
3
|
+
import {TargetConfigurationError} from '../installer/targets.mjs';
|
|
4
|
+
import {assertPlanSnapshot} from '../installer/transaction.mjs';
|
|
5
|
+
import {loadStaticModelCatalog} from '../models/static-catalog.mjs';
|
|
6
|
+
import {installerRegistryOf,platformLabel} from '../platforms/index.mjs';
|
|
7
|
+
import {deriveInstallPlan} from '../tui/derive-install-plan.mjs';
|
|
8
|
+
import {initializeInstallDraft,installPrepareOptions,installSettingsDraft,loadInstallCatalog,loadRoleDefaults} from '../tui/setup.mjs';
|
|
9
|
+
import {createManagementContext,currentInstallState,executeOperation,prepareOperation,readCompositeConfig} from './operations.mjs';
|
|
10
|
+
import {collectStatus} from './status.mjs';
|
|
11
|
+
|
|
12
|
+
export async function buildReapplyRequest({context,installState,statuses,target,currentConfig,loadCatalog}){
|
|
13
|
+
const registry=installerRegistryOf(context),draft={registry};
|
|
14
|
+
if(installState.mode==='composite'&&!currentConfig)throw new TargetConfigurationError('Mixed routing configuration is missing');
|
|
15
|
+
await initializeInstallDraft({
|
|
16
|
+
draft,installState,currentConfig,registry,initialTarget:()=>target,
|
|
17
|
+
loadRoleDefaults:id=>loadRoleDefaults({context,statuses,target:id}),
|
|
18
|
+
});
|
|
19
|
+
const plan=deriveInstallPlan({roles:draft.roles,hosts:draft.hosts,current:installState,registry});
|
|
20
|
+
if(plan.rule!==(target===undefined?'D1-d':'D1-a'))throw new TargetConfigurationError('Configure Apply requires confirmation');
|
|
21
|
+
draft.settings=installSettingsDraft(statuses,plan.platforms);
|
|
22
|
+
const loader=loadCatalog??(id=>loadStaticModelCatalog(id,{signal:context.signal,platforms:registry}));
|
|
23
|
+
const catalogs={};
|
|
24
|
+
for(const id of plan.platforms){
|
|
25
|
+
const result=await loadInstallCatalog(id,{loadCatalog:loader,registry});
|
|
26
|
+
context.signal?.throwIfAborted();
|
|
27
|
+
if(result.status!=='ready')throw new TargetConfigurationError('Model catalog unavailable for '+platformLabel(id,registry));
|
|
28
|
+
catalogs[id]=result.catalog;
|
|
29
|
+
}
|
|
30
|
+
return installPrepareOptions(plan,draft,catalogs);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function assertDraftSnapshot(context,statuses,platforms){
|
|
34
|
+
const snapshot=new Map();
|
|
35
|
+
for(const {platform,target,snapshot:source} of statuses){
|
|
36
|
+
if(!source||!platforms.includes(platform))continue;
|
|
37
|
+
for(const name of ['models.toml','settings.toml','limits.toml']){
|
|
38
|
+
const filename=path.join(target.home,'skills/arc',name);
|
|
39
|
+
snapshot.set(filename,source.get(filename));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
assertPlanSnapshot({snapshot},{safeFs:context.safeFs});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function applyConfiguration(context,options){
|
|
46
|
+
const {installState,statuses,target,currentConfig}=options;
|
|
47
|
+
try{
|
|
48
|
+
context.signal?.throwIfAborted();
|
|
49
|
+
const request=await buildReapplyRequest({context,...options});
|
|
50
|
+
const prepared=await prepareOperation(context,request);
|
|
51
|
+
if(prepared.kind!==(target===undefined?'composite':'install'))throw new TargetConfigurationError('Configure Apply requires confirmation');
|
|
52
|
+
// Catalog and auth checks can yield before the installer takes its own snapshots.
|
|
53
|
+
if(target===undefined?!isDeepStrictEqual(readCompositeConfig(context),currentConfig):currentInstallState(context).mode!==installState.mode){
|
|
54
|
+
throw new TargetConfigurationError('Installed ARC configuration changed during re-apply');
|
|
55
|
+
}
|
|
56
|
+
assertDraftSnapshot(context,statuses,target===undefined?request.platforms:[target]);
|
|
57
|
+
context.signal?.throwIfAborted();
|
|
58
|
+
const result=await executeOperation(context,prepared);
|
|
59
|
+
const error=result.error??result.results.find(item=>item.error)?.error;
|
|
60
|
+
return {
|
|
61
|
+
code:result.code,error,
|
|
62
|
+
unknown:result.activation==='unknown'||result.results.some(item=>item.rollback==='failed'),
|
|
63
|
+
messages:result.messages?.filter(message=>result.activation==='unknown'
|
|
64
|
+
?!message.startsWith('Residual path: '):message.startsWith('Dispatch history stays in ')),
|
|
65
|
+
published:target===undefined?result.activation==='published':result.results.some(item=>item.status==='installed'),
|
|
66
|
+
residualPaths:[...(result.publication?.residualPaths??[]),...(error?.residualPaths??[]),...result.results.flatMap(item=>item.residualPaths??[])],
|
|
67
|
+
};
|
|
68
|
+
}catch(error){return {code:context.signal?.aborted?130:1,error,residualPaths:error.residualPaths??[]};}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function reapplyConfiguration(options={}){
|
|
72
|
+
const {signal,loadCatalog}=options;
|
|
73
|
+
const residualPaths=new Set(),applied=[],failures=[],messages=[];
|
|
74
|
+
let mode,unknown;
|
|
75
|
+
const incomplete=(error,code=signal?.aborted?130:1)=>({
|
|
76
|
+
status:unknown?'unknown':'held',mode,code,error:unknown?.error??error,residualPaths:[...residualPaths],
|
|
77
|
+
...(unknown?{messages:unknown.messages}:error.activeDispatches?{activeDispatches:error.activeDispatches}:{}),
|
|
78
|
+
...(applied.length?{applied}:{}),
|
|
79
|
+
});
|
|
80
|
+
const completed=(code,error)=>({status:'applied',mode,platforms:applied,residualPaths:[...residualPaths],code,...(messages.length?{messages}:{}),...(error?{error}:{})});
|
|
81
|
+
try{
|
|
82
|
+
signal?.throwIfAborted();
|
|
83
|
+
const context=await createManagementContext(options),installState=currentInstallState(context);
|
|
84
|
+
mode=installState.mode;
|
|
85
|
+
if(mode!=='composite'&&mode!=='standalone')return {status:'skipped'};
|
|
86
|
+
const currentConfig=mode==='composite'?readCompositeConfig(context):undefined;
|
|
87
|
+
const statuses=await collectStatus(context);
|
|
88
|
+
signal?.throwIfAborted();
|
|
89
|
+
const targets=mode==='composite'?[undefined]:installerRegistryOf(context).byDisplayOrder()
|
|
90
|
+
.map(({runtime})=>runtime.id).filter(id=>statuses.some(status=>status.platform===id&&status.state==='installed'));
|
|
91
|
+
if(!targets.length)return {status:'skipped'};
|
|
92
|
+
const expected=mode==='composite'?installState.platforms.length:targets.length;
|
|
93
|
+
for(const target of targets){
|
|
94
|
+
const result=await applyConfiguration(context,{installState,statuses,target,currentConfig,loadCatalog});
|
|
95
|
+
for(const filename of result.residualPaths)residualPaths.add(filename);
|
|
96
|
+
const error=result.error??new TargetConfigurationError('Configure Apply did not complete');
|
|
97
|
+
if(result.unknown){
|
|
98
|
+
unknown={error,messages:result.messages};
|
|
99
|
+
return incomplete(error,result.code===130||signal?.aborted?130:1);
|
|
100
|
+
}
|
|
101
|
+
if(result.published){
|
|
102
|
+
applied.push(...(target===undefined?installState.platforms:[target]));
|
|
103
|
+
messages.push(...(result.messages??[]));
|
|
104
|
+
}
|
|
105
|
+
if(result.code===130||signal?.aborted){
|
|
106
|
+
return applied.length===expected?completed(130,result.error??failures[0]):incomplete(error,130);
|
|
107
|
+
}
|
|
108
|
+
if(!result.published||result.code!==0)failures.push(error);
|
|
109
|
+
}
|
|
110
|
+
const error=failures.length>1?new AggregateError(failures,failures.map(failure=>failure.message).join(', ')):failures[0];
|
|
111
|
+
if(applied.length!==expected)return incomplete(error);
|
|
112
|
+
return completed(error?1:0,error);
|
|
113
|
+
}catch(error){
|
|
114
|
+
for(const filename of error.residualPaths??[])residualPaths.add(filename);
|
|
115
|
+
return incomplete(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -2,15 +2,15 @@ import fs from 'node:fs';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import {fileURLToPath} from 'node:url';
|
|
5
|
-
import {installerRegistryOf,platformLabel} from '../platforms/index.mjs';
|
|
5
|
+
import {installerRegistryOf,platformLabel,sortByDisplay} from '../platforms/index.mjs';
|
|
6
6
|
const packageRoot=path.resolve(fileURLToPath(new URL('../../',import.meta.url)));
|
|
7
7
|
const inputError=message=>Object.assign(Error(message),{code:'ARC_CLI_INPUT'});
|
|
8
8
|
const configurationError=message=>Object.assign(Error(message),{code:'ARC_TARGET_CONFIGURATION'});
|
|
9
9
|
function identity(root){const pkg=JSON.parse(fs.readFileSync(path.join(root,'package.json'),'utf8'));if(pkg.name!=='@yunhozz/arc'||!/^\d+\.\d+\.\d+$/.test(pkg.version))throw configurationError('Invalid ARC package identity');return pkg;}
|
|
10
10
|
export async function runtime(deps){
|
|
11
|
-
const [context,state,upgrade,npm]=await Promise.all([import('../npm/context.mjs'),import('../installer/upgrade-state.mjs'),import('../installer/upgrade.mjs'),import('../npm/upgrade.mjs')]);
|
|
11
|
+
const [context,state,upgrade,npm,reapply]=await Promise.all([import('../npm/context.mjs'),import('../installer/upgrade-state.mjs'),import('../installer/upgrade.mjs'),import('../npm/upgrade.mjs'),import('./reapply.mjs')]);
|
|
12
12
|
let safeFs=deps.safeFs;if(!safeFs){const[{loadNative},{openRoot}]=await Promise.all([import('../safe-fs/native.mjs'),import('../safe-fs/index.mjs')]);const native=loadNative();safeFs={openRoot:root=>openRoot(root,{native})};}
|
|
13
|
-
return{...context,...state,...upgrade,...npm,...deps,safeFs};
|
|
13
|
+
return{...context,...state,...upgrade,...npm,...reapply,...deps,safeFs};
|
|
14
14
|
}
|
|
15
15
|
export function report(result,output,error){
|
|
16
16
|
const residualPaths=new Set(),writeResidual=filename=>{if(residualPaths.has(filename))return;residualPaths.add(filename);output.write('Residual path: '+filename+'\n');};
|
|
@@ -21,6 +21,60 @@ export function report(result,output,error){
|
|
|
21
21
|
error.write('Harness update did not complete. Run arc again and choose Configure to retry the harness update.\n');return 1;
|
|
22
22
|
}
|
|
23
23
|
export function failure(cause,error){error.write('Error: '+cause.message+'\n');return ['ARC_CANCELLED','ARC_NPM_CANCELLED'].includes(cause.code)?130:['ARC_CLI_INPUT','ARC_TARGET_CONFIGURATION','ARC_UNSUPPORTED_RUNTIME','ARC_NATIVE_UNAVAILABLE'].includes(cause.code)?2:1;}
|
|
24
|
+
export async function upgradeAndReapply({api,root,state,output,error,signal,env,cwd,userHome}){
|
|
25
|
+
const platforms=api.platforms??state.registry;
|
|
26
|
+
const code=report(await api.upgradeInstalledTargets({packageRoot:root,state,safeFs:api.safeFs,signal,registry:platforms}),output,error);
|
|
27
|
+
if(signal?.aborted){
|
|
28
|
+
if(code===0){
|
|
29
|
+
error.write('Configuration was not re-applied.\n');
|
|
30
|
+
error.write('Run arc → Configure → Apply to re-apply the configuration.\n');
|
|
31
|
+
}
|
|
32
|
+
return 130;
|
|
33
|
+
}
|
|
34
|
+
if(code!==0)return code;
|
|
35
|
+
let result;
|
|
36
|
+
try{
|
|
37
|
+
result=await api.reapplyConfiguration({packageRoot:root,userHome,cwd,env,safeFs:api.safeFs,signal,platforms,runtimePlatforms:api.runtimePlatforms,loadCatalog:api.loadCatalog});
|
|
38
|
+
}catch(cause){result={status:'held',code:1,error:cause,activeDispatches:cause.activeDispatches,residualPaths:cause.residualPaths};}
|
|
39
|
+
if(result.status==='skipped')return signal?.aborted?130:0;
|
|
40
|
+
const interrupted=signal?.aborted||result.code===130;
|
|
41
|
+
const registry=installerRegistryOf({platforms});
|
|
42
|
+
const labels=ids=>sortByDisplay(ids,registry).map(id=>platformLabel(id,registry));
|
|
43
|
+
if(result.status==='unknown'){
|
|
44
|
+
error.write('Configuration re-apply state is unknown.\n');
|
|
45
|
+
const notices=result.messages?.length?result.messages:['Configuration publication state is unknown; inspect the reported paths before retrying.'];
|
|
46
|
+
for(const notice of notices)error.write(notice+'\n');
|
|
47
|
+
if(result.applied?.length)error.write('Configuration re-applied for: '+labels(result.applied).join(', ')+'.\n');
|
|
48
|
+
if(result.error)error.write('Error: '+result.error.message+'\n');
|
|
49
|
+
for(const filename of new Set(result.residualPaths))error.write('Residual path: '+filename+'\n');
|
|
50
|
+
return interrupted?130:result.code;
|
|
51
|
+
}
|
|
52
|
+
if(result.status==='applied'){
|
|
53
|
+
const names=labels(result.platforms);
|
|
54
|
+
const label=result.mode==='composite'?'Mixed routing ('+names.join(' + ')+')':names.join(', ');
|
|
55
|
+
output.write('Configuration re-applied: '+label+'.\n');
|
|
56
|
+
for(const message of result.messages??[])output.write(message+'\n');
|
|
57
|
+
if(interrupted)error.write('Interrupted after the configuration was re-applied.\n');
|
|
58
|
+
if(result.error)error.write('Error: '+result.error.message+'\n');
|
|
59
|
+
}else if(interrupted&&result.applied?.length){
|
|
60
|
+
error.write('Configuration was re-applied only for: '+labels(result.applied).join(', ')+'.\n');
|
|
61
|
+
error.write('Interrupted before the remaining platforms were re-applied.\n');
|
|
62
|
+
error.write('Run arc → Configure → Apply to re-apply the configuration.\n');
|
|
63
|
+
}else{
|
|
64
|
+
if(result.applied?.length)error.write('Configuration was re-applied only for: '+labels(result.applied).join(', ')+'.\n');
|
|
65
|
+
error.write('Configuration was not re-applied.\n');
|
|
66
|
+
if(result.activeDispatches?.length){
|
|
67
|
+
error.write('Active bridge dispatches ('+result.activeDispatches.length+'): '+result.activeDispatches.join(', ')+'\n');
|
|
68
|
+
error.write('After they finish, run arc → Configure → Apply.\n');
|
|
69
|
+
}else{
|
|
70
|
+
error.write('Error: '+result.error.message+'\n');
|
|
71
|
+
error.write('Run arc → Configure → Apply to re-apply the configuration.\n');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
for(const filename of new Set(result.residualPaths))output.write('Residual path: '+filename+'\n');
|
|
75
|
+
return interrupted?130:result.code;
|
|
76
|
+
}
|
|
77
|
+
|
|
24
78
|
export async function runChild(request,io={},deps={}){
|
|
25
79
|
const output=io.output??process.stdout,error=io.error??process.stderr;let onInterrupt;
|
|
26
80
|
try{
|
|
@@ -28,10 +82,10 @@ export async function runChild(request,io={},deps={}){
|
|
|
28
82
|
const root=deps.packageRoot??packageRoot,pkg=identity(root);if(pkg.version!==request.expectedVersion)throw configurationError('The new ARC package version does not match the requested upgrade');
|
|
29
83
|
const api=await runtime(deps),env=io.env??process.env,cwd=request.invocationCwd,context=await api.inspectNpmContext({packageRoot:root,entryPath:path.join(root,'bin/arc-upgrade.mjs'),env,cwd});
|
|
30
84
|
if(context.kind!=='global'||context.packageRoot!==root)throw configurationError('Cannot verify the replaced global ARC package');
|
|
31
|
-
const state=api.collectInstalledState({safeFs:api.safeFs,userHome
|
|
85
|
+
const userHome=deps.userHome??os.homedir(),state=api.collectInstalledState({safeFs:api.safeFs,userHome,env,cwd,platforms:api.platforms,runtimePlatforms:api.runtimePlatforms});if(state.stateToken!==request.expectedStateToken)throw configurationError('Installed ARC settings changed during CLI replacement; retry upgrade');
|
|
32
86
|
if(!state.targets.length)throw configurationError('No installed ARC harness found');
|
|
33
87
|
const controller=new AbortController();onInterrupt=()=>controller.abort();process.once('SIGINT',onInterrupt);process.once('SIGTERM',onInterrupt);
|
|
34
|
-
return
|
|
88
|
+
return await upgradeAndReapply({api,root,state,output,error,signal:controller.signal,env,cwd,userHome});
|
|
35
89
|
}catch(cause){return failure(cause,error);}finally{if(onInterrupt){process.removeListener('SIGINT',onInterrupt);process.removeListener('SIGTERM',onInterrupt);}}
|
|
36
90
|
}
|
|
37
91
|
|