Promote a pipeline-held go once the pipeline is green, and stop calling every wait "nunggu MR lain". lti-api !1388 was a go held at waiting because its pipeline was still running; the pipeline turned green but only a new commit could move the verdict, so the board never offered Gas and labelled it as waiting on another MR. The Hub now restores the model's go (and its own reason) on the next poll when the reviewed commit's pipeline is success, edits the verdict note and notifies; a waiting the model chose itself stays. The board's waiting mark is an hourglass with a neutral label.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
const META = {
|
const META = {
|
||||||
checking: { zone: 'cek', flag: '#7FA9C4', aria: 'sedang dicek', word: 'Dicek dulu', bg: '#E1EDF1', ink: '#1F4B5E', icon: 'dots' },
|
checking: { zone: 'cek', flag: '#7FA9C4', aria: 'sedang dicek', word: 'Dicek dulu', bg: '#E1EDF1', ink: '#1F4B5E', icon: 'dots' },
|
||||||
fix: { zone: 'cek', flag: '#D9654B', aria: 'ditahan reviewer', word: 'Tahan', bg: '#F8DDD5', ink: '#9A2E1A', icon: 'stop' },
|
fix: { zone: 'cek', flag: '#D9654B', aria: 'ditahan reviewer', word: 'Tahan', bg: '#F8DDD5', ink: '#9A2E1A', icon: 'stop' },
|
||||||
blocked: { zone: 'cek', flag: '#9AA5A8', aria: 'nunggu MR lain', word: 'Nunggu', bg: '#EEF1F0', ink: '#3E4E53', icon: 'link' },
|
blocked: { zone: 'cek', flag: '#9AA5A8', aria: 'nunggu, lihat alasannya', word: 'Nunggu', bg: '#EEF1F0', ink: '#3E4E53', icon: 'wait' },
|
||||||
manual: { zone: 'cek', flag: '#B7AE9C', aria: 'perlu dicek manual', word: 'Cek manual', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
manual: { zone: 'cek', flag: '#B7AE9C', aria: 'perlu dicek manual', word: 'Cek manual', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
||||||
parked: { zone: 'cek', flag: '#B7AE9C', aria: 'ditunda', word: 'Ditunda', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
parked: { zone: 'cek', flag: '#B7AE9C', aria: 'ditunda', word: 'Ditunda', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
||||||
ready: { zone: 'siap', flag: '#E8A33D', aria: 'aman, nunggu gas', word: 'Aman', bg: '#DDEFE5', ink: '#2E7A4E', icon: 'ok' },
|
ready: { zone: 'siap', flag: '#E8A33D', aria: 'aman, nunggu gas', word: 'Aman', bg: '#DDEFE5', ink: '#2E7A4E', icon: 'ok' },
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
const ICON = {
|
const ICON = {
|
||||||
ok: '<svg width="26" height="26" viewBox="0 0 16 16"><path d="M3 8.5l3 3 7-7" fill="none" stroke="#FFFFFF" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
ok: '<svg width="26" height="26" viewBox="0 0 16 16"><path d="M3 8.5l3 3 7-7" fill="none" stroke="#FFFFFF" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
||||||
stop: '<svg width="26" height="26" viewBox="0 0 18 18"><path d="M9 3v12M4.5 10.5a4.5 4.5 0 0 0 9 0M6 6h6" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/><circle cx="9" cy="3" r="1.6" fill="#FFFFFF"/></svg>',
|
stop: '<svg width="26" height="26" viewBox="0 0 18 18"><path d="M9 3v12M4.5 10.5a4.5 4.5 0 0 0 9 0M6 6h6" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/><circle cx="9" cy="3" r="1.6" fill="#FFFFFF"/></svg>',
|
||||||
link: '<svg width="26" height="26" viewBox="0 0 16 16"><path d="M7 9.5l2-2M5.5 11.5l-1 1a2.1 2.1 0 0 1-3-3l2-2a2.1 2.1 0 0 1 3 0M10.5 4.5l1-1a2.1 2.1 0 0 1 3 3l-2 2a2.1 2.1 0 0 1-3 0" fill="none" stroke="#FFFFFF" stroke-width="1.8" stroke-linecap="round"/></svg>',
|
wait: '<svg width="26" height="26" viewBox="0 0 16 16"><path d="M4 2h8M4 14h8M5 2c0 3 6 3 6 6s-6 3-6 6M11 2c0 3-6 3-6 6s6 3 6 6" fill="none" stroke="#FFFFFF" stroke-width="1.6" stroke-linecap="round"/></svg>',
|
||||||
pause: '<svg width="24" height="24" viewBox="0 0 16 16"><path d="M5.5 3.5v9M10.5 3.5v9" stroke="#FFFFFF" stroke-width="2.4" stroke-linecap="round"/></svg>',
|
pause: '<svg width="24" height="24" viewBox="0 0 16 16"><path d="M5.5 3.5v9M10.5 3.5v9" stroke="#FFFFFF" stroke-width="2.4" stroke-linecap="round"/></svg>',
|
||||||
dots: '<span class="dots"><i></i><i></i><i></i></span>',
|
dots: '<span class="dots"><i></i><i></i><i></i></span>',
|
||||||
x: '<svg width="22" height="22" viewBox="0 0 16 16"><path d="M4 4l8 8M12 4l-8 8" stroke="#FFFFFF" stroke-width="2.4" stroke-linecap="round"/></svg>',
|
x: '<svg width="22" height="22" viewBox="0 0 16 16"><path d="M4 4l8 8M12 4l-8 8" stroke="#FFFFFF" stroke-width="2.4" stroke-linecap="round"/></svg>',
|
||||||
@@ -144,7 +144,8 @@
|
|||||||
if (title) b.append(el('span', { class: 'boat-title' }, title));
|
if (title) b.append(el('span', { class: 'boat-title' }, title));
|
||||||
const marks = el('span', { class: 'marks', 'aria-hidden': 'true' });
|
const marks = el('span', { class: 'marks', 'aria-hidden': 'true' });
|
||||||
if (a.status === 'checking' || a.status === 'sailing' || a.status === 'gas') marks.innerHTML = ICON.dots;
|
if (a.status === 'checking' || a.status === 'sailing' || a.status === 'gas') marks.innerHTML = ICON.dots;
|
||||||
if (a.status === 'blocked') marks.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16"><path d="M7 9.5l2-2M5.5 11.5l-1 1a2.1 2.1 0 0 1-3-3l2-2a2.1 2.1 0 0 1 3 0M10.5 4.5l1-1a2.1 2.1 0 0 1 3 3l-2 2a2.1 2.1 0 0 1-3 0" fill="none" stroke="#3E4E53" stroke-width="1.8" stroke-linecap="round"/></svg>';
|
// Waiting can be a pipeline or another MR, so the mark is an hourglass, not a link.
|
||||||
|
if (a.status === 'blocked') marks.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16"><path d="M4 2h8M4 14h8M5 2c0 3 6 3 6 6s-6 3-6 6M11 2c0 3-6 3-6 6s6 3 6 6" fill="none" stroke="#3E4E53" stroke-width="1.6" stroke-linecap="round"/></svg>';
|
||||||
b.append(marks);
|
b.append(marks);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,3 +132,4 @@ Detailed when it starts. Known shape: `depends_on` stored as data; a NO-GO propa
|
|||||||
- 2026-11-06: the hosted reviewer runs in its own container without GitLab tokens, since Codex's sandbox cannot run inside Docker (Sen chose this over hosting without Docker).
|
- 2026-11-06: the hosted reviewer runs in its own container without GitLab tokens, since Codex's sandbox cannot run inside Docker (Sen chose this over hosting without Docker).
|
||||||
- 2026-11-09: deploy setup (CI, Dockerfiles, compose, manifests) belongs to devops (rubric R13). Deploy findings tag the `devops` users from hub.json instead of asking the developer to change CI; the reviewer never suggests CI edits to the developer (Sen, after lti-api !1380).
|
- 2026-11-09: deploy setup (CI, Dockerfiles, compose, manifests) belongs to devops (rubric R13). Deploy findings tag the `devops` users from hub.json instead of asking the developer to change CI; the reviewer never suggests CI edits to the developer (Sen, after lti-api !1380).
|
||||||
- 2026-11-09: a turn the model provider fails (Codex `turn.status: failed`, e.g. 9router "high demand") is not a rejected verdict. The Hub throws `ReviewerUnavailable`, sends nothing back to the model, and the queue waits 2, 4, 8, 16 and 32 minutes before giving up with a comment that says the model could not be reached (lti-api !1388, lti-web-client !859).
|
- 2026-11-09: a turn the model provider fails (Codex `turn.status: failed`, e.g. 9router "high demand") is not a rejected verdict. The Hub throws `ReviewerUnavailable`, sends nothing back to the model, and the queue waits 2, 4, 8, 16 and 32 minutes before giving up with a comment that says the model could not be reached (lti-api !1388, lti-web-client !859).
|
||||||
|
- 2026-11-09: a `go` held at `waiting` only by the pipeline hard rule becomes `go` on the next poll once the reviewed commit's pipeline is `success` (same commit, no new review; verdict note edited, "siap gas" notified). A `waiting` the model chose itself is never promoted. The board's waiting label no longer claims "nunggu MR lain" (lti-api !1388).
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ export type Finding = { kind: 'bad' | 'ok' | 'todo'; text: string; evidence: Evi
|
|||||||
export type Verdict = { verdict: 'go' | 'no_go' | 'waiting'; reason: string; findings: Finding[]; post_deploy: Array<{ text: string; evidence: Evidence[] }> };
|
export type Verdict = { verdict: 'go' | 'no_go' | 'waiting'; reason: string; findings: Finding[]; post_deploy: Array<{ text: string; evidence: Evidence[] }> };
|
||||||
|
|
||||||
export type ResolvedEvidence = Evidence & { label: string; url: string };
|
export type ResolvedEvidence = Evidence & { label: string; url: string };
|
||||||
|
// The hard rule that holds a `go` while the reviewed commit's pipeline is not green yet.
|
||||||
|
export const PIPELINE_HOLD = 'go → waiting: pipeline is ';
|
||||||
|
|
||||||
export type Checked = {
|
export type Checked = {
|
||||||
verdict: Verdict['verdict'];
|
verdict: Verdict['verdict'];
|
||||||
reason: string;
|
reason: string;
|
||||||
@@ -63,6 +66,8 @@ export type Checked = {
|
|||||||
postDeploy: Array<{ text: string; evidence: ResolvedEvidence[] }>;
|
postDeploy: Array<{ text: string; evidence: ResolvedEvidence[] }>;
|
||||||
dropped: string[];
|
dropped: string[];
|
||||||
overrides: string[];
|
overrides: string[];
|
||||||
|
// The model's own reason when a hard rule held its `go`, so the go can be restored later.
|
||||||
|
heldReason?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Context = {
|
export type Context = {
|
||||||
@@ -159,10 +164,12 @@ export async function check(v: Verdict, ctx: Context): Promise<{ checked: Checke
|
|||||||
const overrides: string[] = [];
|
const overrides: string[] = [];
|
||||||
let verdict = v.verdict;
|
let verdict = v.verdict;
|
||||||
let reason = v.reason;
|
let reason = v.reason;
|
||||||
|
let heldReason: string | undefined;
|
||||||
if (verdict === 'go' && ctx.pipeline && ctx.pipeline.status !== 'success') {
|
if (verdict === 'go' && ctx.pipeline && ctx.pipeline.status !== 'success') {
|
||||||
verdict = 'waiting';
|
verdict = 'waiting';
|
||||||
|
heldReason = reason;
|
||||||
reason = 'Nunggu pipeline hijau.';
|
reason = 'Nunggu pipeline hijau.';
|
||||||
overrides.push(`go → waiting: pipeline is ${ctx.pipeline.status}`);
|
overrides.push(`${PIPELINE_HOLD}${ctx.pipeline.status}`);
|
||||||
}
|
}
|
||||||
return { checked: { verdict, reason, findings, postDeploy, dropped, overrides }, errors: [] };
|
return { checked: { verdict, reason, findings, postDeploy, dropped, overrides, ...(heldReason ? { heldReason } : {}) }, errors: [] };
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/hub.ts
18
src/hub.ts
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|||||||
import type { MrInfo, MrRef, MrSummary, Note } from './gitlab.ts';
|
import type { MrInfo, MrRef, MrSummary, Note } from './gitlab.ts';
|
||||||
import type { TurnResult } from './codex.ts';
|
import type { TurnResult } from './codex.ts';
|
||||||
import type { ReviewOutcome, Reviewer, Session } from './review.ts';
|
import type { ReviewOutcome, Reviewer, Session } from './review.ts';
|
||||||
import type { Checked } from './contract.ts';
|
import { PIPELINE_HOLD, type Checked } from './contract.ts';
|
||||||
import { Store, type Ajuan, type OutboxItem, type QueuedEvent, type Release, type ReleaseChanges } from './store.ts';
|
import { Store, type Ajuan, type OutboxItem, type QueuedEvent, type Release, type ReleaseChanges } from './store.ts';
|
||||||
import { latestTag, nextTag, releaseNotes, tagProblem } from './release.ts';
|
import { latestTag, nextTag, releaseNotes, tagProblem } from './release.ts';
|
||||||
import { verdictComment, errorComment, replyComment, rereviewComment, devopsComment, needsDevops, decisionComment, gasComment, closeComment, ajuanNote, VERDICT_MARKER, type Stamp } from './render.ts';
|
import { verdictComment, errorComment, replyComment, rereviewComment, devopsComment, needsDevops, decisionComment, gasComment, closeComment, ajuanNote, VERDICT_MARKER, type Stamp } from './render.ts';
|
||||||
@@ -153,6 +153,20 @@ export class Hub {
|
|||||||
this.log(`ajuan dibuka lagi: ${a.project} !${a.iid}`);
|
this.log(`ajuan dibuka lagi: ${a.project} !${a.iid}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A `go` held only because the reviewed commit's pipeline was still running becomes a `go`
|
||||||
|
// once that pipeline is green: no new review, the same commit and findings (lti-api !1388).
|
||||||
|
private async pipelineGreen(a: Ajuan): Promise<void> {
|
||||||
|
const c = a.verdict_json ? (JSON.parse(a.verdict_json) as Checked) : null;
|
||||||
|
if (!c || !c.overrides.some((o) => o.startsWith(PIPELINE_HOLD))) return;
|
||||||
|
const { heldReason, ...rest } = c;
|
||||||
|
const next: Checked = { ...rest, verdict: 'go', reason: heldReason ?? 'Pipeline sudah hijau.', overrides: [...c.overrides.filter((o) => !o.startsWith(PIPELINE_HOLD)), 'waiting → go: pipeline success'] };
|
||||||
|
this.store.update(a.id, { status: 'go', verdict_json: JSON.stringify(next) });
|
||||||
|
const stamp = { ...this.stamp(a, null, a.reviewed_sha!), rubricVersion: a.rubric_version ?? '-' };
|
||||||
|
await this.publishVerdict(this.store.ajuanById(a.id), verdictComment(next, stamp, this.devopsFor(next)));
|
||||||
|
this.notify(`ready:${a.id}:${a.reviewed_sha}`, a, `🟢 ${this.label(a)} siap gas: ${next.reason}`);
|
||||||
|
this.log(`pipeline hijau: ${a.project} !${a.iid} → go di ${a.reviewed_sha!.slice(0, 8)}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Reconcile GitLab into the store: new labelled MRs, new heads, closed MRs, mentions.
|
// Reconcile GitLab into the store: new labelled MRs, new heads, closed MRs, mentions.
|
||||||
async poll(): Promise<void> {
|
async poll(): Promise<void> {
|
||||||
for (const project of this.config.projects) {
|
for (const project of this.config.projects) {
|
||||||
@@ -175,6 +189,8 @@ export class Hub {
|
|||||||
this.newCommitClearsDecision(a);
|
this.newCommitClearsDecision(a);
|
||||||
if (!this.store.hasPending(a.id, 'new_commit') && !this.store.hasPending(a.id, 'opened')) this.store.enqueue(a.id, 'new_commit', { sha: m.sha });
|
if (!this.store.hasPending(a.id, 'new_commit') && !this.store.hasPending(a.id, 'opened')) this.store.enqueue(a.id, 'new_commit', { sha: m.sha });
|
||||||
this.log(`commit baru: ${a.project} !${a.iid} → ${m.sha.slice(0, 8)}`);
|
this.log(`commit baru: ${a.project} !${a.iid} → ${m.sha.slice(0, 8)}`);
|
||||||
|
} else if (a.status === 'waiting' && a.reviewed_sha === m.sha && m.pipelineStatus === 'success') {
|
||||||
|
await this.pipelineGreen(a);
|
||||||
}
|
}
|
||||||
const notes = await this.ports.gitlab.listNotes(ref, a.last_note_id);
|
const notes = await this.ports.gitlab.listNotes(ref, a.last_note_id);
|
||||||
const mention = this.mentionPattern();
|
const mention = this.mentionPattern();
|
||||||
|
|||||||
@@ -756,3 +756,55 @@ test('a provider down for about an hour ends in a manual check that says so', as
|
|||||||
assert.doesNotMatch(body, /not valid JSON/);
|
assert.doesNotMatch(body, /not valid JSON/);
|
||||||
assert.equal(w.store.nextEvent(), undefined);
|
assert.equal(w.store.nextEvent(), undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// lti-api !1388 (2026-11-09): the model said go, the pipeline was still running, so the hard
|
||||||
|
// rule held it at waiting. The pipeline turned green but nothing moved it, and the board
|
||||||
|
// showed no Gas.
|
||||||
|
test('a go held by a running pipeline becomes go once that pipeline is green, without a new review', async () => {
|
||||||
|
const w = world();
|
||||||
|
w.gl.mrs.set(31, { sha: 'efef3333', state: 'opened', labels: ['labuh'], pipelineStatus: 'running' });
|
||||||
|
const held: Checked = { ...checked('go', 'Urutan deploy aman.'), verdict: 'waiting', reason: 'Nunggu pipeline hijau.', heldReason: 'Urutan deploy aman.', overrides: ['go → waiting: pipeline is running'] };
|
||||||
|
w.script(ok(held));
|
||||||
|
await w.hub.poll();
|
||||||
|
await w.hub.drain();
|
||||||
|
const a = () => w.store.ajuan(PROJECT, 31)!;
|
||||||
|
assert.equal(a().status, 'waiting');
|
||||||
|
assert.deepEqual(allowedActions(a(), false), ['tunda', 'tolak'], 'no Gas while waiting');
|
||||||
|
|
||||||
|
await w.hub.poll();
|
||||||
|
assert.equal(a().status, 'waiting', 'still running: nothing changes');
|
||||||
|
|
||||||
|
w.gl.mrs.get(31)!.pipelineStatus = 'success';
|
||||||
|
await w.hub.poll();
|
||||||
|
assert.equal(a().status, 'go');
|
||||||
|
assert.equal(w.calls.review.length, 1, 'no second review');
|
||||||
|
const v = JSON.parse(a().verdict_json!);
|
||||||
|
assert.equal(v.reason, 'Urutan deploy aman.');
|
||||||
|
assert.deepEqual(v.overrides, ['waiting → go: pipeline success']);
|
||||||
|
assert.ok(allowedActions(a(), false).includes('gas'));
|
||||||
|
const verdict = w.store.outbox(a().id).find((o) => o.kind === 'verdict')!;
|
||||||
|
assert.match(verdict.body, /Aman|aman|🟢/);
|
||||||
|
assert.match(verdict.body, /waiting → go: pipeline success/);
|
||||||
|
|
||||||
|
await w.hub.poll();
|
||||||
|
assert.equal(w.store.outbox(a().id).filter((o) => o.kind === 'verdict').length, 1, 'the verdict note is edited, not duplicated');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a waiting the model chose itself, or a failed pipeline, is not promoted', async () => {
|
||||||
|
const w = world();
|
||||||
|
w.gl.mrs.set(32, { sha: 'a0a04444', state: 'opened', labels: ['labuh'], pipelineStatus: 'success' });
|
||||||
|
w.script(ok({ ...checked('go', 'x'), verdict: 'waiting', reason: 'Nunggu MR backend.' }));
|
||||||
|
await w.hub.poll();
|
||||||
|
await w.hub.drain();
|
||||||
|
await w.hub.poll();
|
||||||
|
assert.equal(w.store.ajuan(PROJECT, 32)!.status, 'waiting');
|
||||||
|
|
||||||
|
const f = world();
|
||||||
|
f.gl.mrs.set(33, { sha: 'b0b05555', state: 'opened', labels: ['labuh'], pipelineStatus: 'running' });
|
||||||
|
f.script(ok({ ...checked('go', 'x'), verdict: 'waiting', reason: 'Nunggu pipeline hijau.', heldReason: 'x', overrides: ['go → waiting: pipeline is running'] }));
|
||||||
|
await f.hub.poll();
|
||||||
|
await f.hub.drain();
|
||||||
|
f.gl.mrs.get(33)!.pipelineStatus = 'failed';
|
||||||
|
await f.hub.poll();
|
||||||
|
assert.equal(f.store.ajuan(PROJECT, 33)!.status, 'waiting');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user