fix(P01): replace hardcoded phase=1 in orchestrator and fix getDecisions double-fetch
---ci---
project: ci
phase: 1
milestone: v0.8
status: in_progress
decisions:
- id: D-021
decision: 6-phase wave-ordered vertical slices for v0.8
rationale: Each phase independently demoable; critical fixes first
confidence: 0.90
requirements:
covered: [FIX-01, FIX-06]
---/ci---
FIX-01: Replace 5 hardcoded phase=1 literals in orchestrator.ts mechanical
execution path with this.pipelineState!.current_phase. The orchestrator
correctly tracks current_phase but commits always embedded literal 1.
FIX-06: Replace getDecisions() redundant double-fetch with single
getRecentCommits(50) call, delegating to existing getDecisionsFromCommits().
Old code called getRecentCommits(50) once per grep match entry (O(N*M)
when it should be O(1)).
This commit is contained in:
Generated
+3
-4
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"name": "@continuous-intelligence/ciagent",
|
||||
"version": "0.5.0",
|
||||
"version": "0.7.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@continuous-intelligence/ciagent",
|
||||
"version": "0.5.0",
|
||||
"hasInstallScript": true,
|
||||
"name": "@continuous-intelligence/ciagent",
|
||||
"version": "0.7.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^12.1.0",
|
||||
|
||||
@@ -500,7 +500,7 @@ export class OrchestratorAgent extends BaseAgent {
|
||||
|
||||
case "research": {
|
||||
this.log("Researching project domain...");
|
||||
this.decisionEngine!.setPhase(1);
|
||||
this.decisionEngine!.setPhase(this.pipelineState!.current_phase);
|
||||
|
||||
const archMd = this.ciFiles!.readArchitectureMd();
|
||||
if (!archMd) {
|
||||
@@ -519,7 +519,7 @@ export class OrchestratorAgent extends BaseAgent {
|
||||
|
||||
if (this.config.git.auto_commit && this.gitContext!.isGitRepo()) {
|
||||
const researchCommit = CommitBuilder.buildResearchCommit(
|
||||
1,
|
||||
this.pipelineState!.current_phase,
|
||||
this.currentMilestone,
|
||||
"initial domain research",
|
||||
["Research completed. Key findings in .ciagent/ARCHITECTURE.md and .ciagent/PROJECT.md updates."]
|
||||
@@ -543,7 +543,7 @@ export class OrchestratorAgent extends BaseAgent {
|
||||
this.log("Planning phase execution...");
|
||||
|
||||
if (this.config.git.branching_strategy === "phase" && this.gitBranch && this.gitContext!.isGitRepo()) {
|
||||
this.gitBranch.createPhaseBranch(1, "initial-phase");
|
||||
this.gitBranch.createPhaseBranch(this.pipelineState!.current_phase, "initial-phase");
|
||||
}
|
||||
|
||||
this.pipelineState!.plan_completed = true;
|
||||
@@ -623,7 +623,7 @@ export class OrchestratorAgent extends BaseAgent {
|
||||
|
||||
if (this.config.git.auto_commit && this.gitContext!.isGitRepo()) {
|
||||
const verifyCommit = CommitBuilder.buildVerifyCommit({
|
||||
phase: 1,
|
||||
phase: this.pipelineState!.current_phase,
|
||||
milestone: this.currentMilestone,
|
||||
subject: "automated verification passed",
|
||||
requirements: { covered: [], partial: [] },
|
||||
@@ -646,7 +646,7 @@ export class OrchestratorAgent extends BaseAgent {
|
||||
|
||||
if (this.config.git.auto_commit && this.gitContext!.isGitRepo()) {
|
||||
const completionCommit = CommitBuilder.buildPhaseCompletionCommit({
|
||||
phase: 1,
|
||||
phase: this.pipelineState!.current_phase,
|
||||
milestone: this.currentMilestone,
|
||||
phaseName: "initial-phase",
|
||||
tasksCompleted: 0,
|
||||
|
||||
+2
-20
@@ -185,26 +185,8 @@ export class GitContext {
|
||||
}
|
||||
|
||||
getDecisions(phase?: number): CommitDecision[] {
|
||||
const grepArg = phase !== undefined ? `--grep="phase: ${phase}"` : '--grep="decisions:"';
|
||||
const raw = this.git(`log --all ${grepArg} --format="%B%x01"`);
|
||||
|
||||
if (!raw) return [];
|
||||
|
||||
const decisions: CommitDecision[] = [];
|
||||
const entries = raw.split("\x01").filter(Boolean);
|
||||
|
||||
for (const entry of entries) {
|
||||
const commits = this.getRecentCommits(50);
|
||||
for (const commit of commits) {
|
||||
if (commit.ci?.decisions) {
|
||||
if (phase === undefined || commit.ci.phase === phase) {
|
||||
decisions.push(...commit.ci.decisions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return decisions;
|
||||
const commits = this.getRecentCommits(50);
|
||||
return this.getDecisionsFromCommits(commits, phase);
|
||||
}
|
||||
|
||||
getDecisionsFromCommits(commits: ParsedCIAgentCommit[], phase?: number): CommitDecision[] {
|
||||
|
||||
Reference in New Issue
Block a user