Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: accept a completed-closed issue as an audit finding disposition

Adam Eivy5938fddb6c5b
diff --git a/server/services/auditFindings.js b/server/services/auditFindings.js
index 189d21fdf0..dc8a6116bd 100644
--- a/server/services/auditFindings.js
+++ b/server/services/auditFindings.js
@@ -31,7 +31,10 @@ async function verifyFinding(finding, { workspacePath, task }, deps) {
const { execGh } = await import('./github.js');
const raw = await execGh(['api', '--hostname', target.apiHost, `repos/${target.fullName}/issues/${number}`], 15_000, options);
const issue = safeJSONParse(raw, null);
- return issue?.html_url === url && issue.state === 'open' && !issue.pull_request;
+ // A concurrent CoS claim can fix and close a freshly filed issue before this
+ // check runs; closed-as-completed is still a tracked, resolved disposition.
+ const tracked = issue?.state === 'open' || (issue?.state === 'closed' && issue.state_reason === 'completed');
+ return issue?.html_url === url && tracked && !issue.pull_request;
}
if (target.forge === 'gitlab') {
const { execGlab } = await import('./gitlab.js');
diff --git a/server/services/auditFindings.test.js b/server/services/auditFindings.test.js
index 0d48659c61..aec4330bc6 100644
--- a/server/services/auditFindings.test.js
+++ b/server/services/auditFindings.test.js
@@ -96,16 +96,23 @@ describe('persisted audit disposition workflow', () => {
results: [{ key: 'dispatch-authority', status: 'unchecked' }, { key: 'second-boundary', status: 'unchecked' }] });
});
- it.each(['unreachable', 'closed', 'pull-request', 'other-repository'])('retains actionable rows when issue verification is %s, then safely retries', async failure => {
+ it.each(['unreachable', 'closed', 'not-planned', 'pull-request', 'other-repository'])('retains actionable rows when issue verification is %s, then safely retries', async failure => {
if (failure === 'unreachable') forge.execGh.mockRejectedValueOnce(new Error('offline'));
else forge.execGh.mockResolvedValueOnce(JSON.stringify({ html_url: failure === 'other-repository' ? url.replace('/repo/', '/other/') : url,
- state: failure === 'closed' ? 'closed' : 'open', ...(failure === 'pull-request' ? { pull_request: {} } : {}) }));
+ state: failure === 'closed' || failure === 'not-planned' ? 'closed' : 'open',
+ ...(failure === 'not-planned' ? { state_reason: 'not_planned' } : {}), ...(failure === 'pull-request' ? { pull_request: {} } : {}) }));
await deliver('agent-one', [finding()]);
expect(await settle()).toMatchObject({ status: 'incomplete', unresolved: 1 });
expect((await readRecord('agent-one')).metadata.auditFindings.report.findings).toEqual([finding()]);
expect(await settle()).toMatchObject({ status: 'complete', unresolved: 0 });
});
+ it('accepts an issue a concurrent claim closed as completed before verification ran', async () => {
+ forge.execGh.mockResolvedValueOnce(JSON.stringify({ html_url: url, state: 'closed', state_reason: 'completed' }));
+ await deliver('agent-one', [finding()]);
+ expect(await settle()).toMatchObject({ status: 'complete', unresolved: 0 });
+ });
+
it('requires reachable commit evidence and explicit validation without executing model-supplied commands', async () => {
await execGit(['init'], dir);
await writeFile(join(dir, 'dispatch.js'), 'export const authorized = true;\n');