666db0b939
Persist goal runs in MySQL, bind agent runs to checkpoints, expose awaiting-approval UX in chat, and add admin inspection routes with local verify scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
825 B
JavaScript
34 lines
825 B
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { shouldRequireCheckpointApproval } from './goal-run-policy.mjs';
|
|
|
|
test('shouldRequireCheckpointApproval gates multi-stage checkpoints by default', () => {
|
|
assert.equal(
|
|
shouldRequireCheckpointApproval({
|
|
env: {},
|
|
pendingCheckpointCount: 1,
|
|
totalCheckpointCount: 2,
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
shouldRequireCheckpointApproval({
|
|
env: {},
|
|
pendingCheckpointCount: 0,
|
|
totalCheckpointCount: 1,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test('shouldRequireCheckpointApproval honors GOAL_RUN_REQUIRE_APPROVAL', () => {
|
|
assert.equal(
|
|
shouldRequireCheckpointApproval({
|
|
env: { GOAL_RUN_REQUIRE_APPROVAL: '1' },
|
|
pendingCheckpointCount: 0,
|
|
totalCheckpointCount: 1,
|
|
}),
|
|
true,
|
|
);
|
|
});
|