MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / gatherSessionEvidence

Function gatherSessionEvidence

src/agent/completion-gate.ts:73–103  ·  view source on GitHub ↗
(messages: MsgLike[])

Source from the content-addressed store, hash-verified

71}
72
73export function gatherSessionEvidence(messages: MsgLike[]): SessionEvidence {
74 let didSuccessfulEdit = false;
75 let didRunTests = false;
76 let didRunShell = false;
77
78 for (const m of messages) {
79 // Attempted tool calls (assistant side) — read shell command args for test runners.
80 if (m.role === 'assistant' && Array.isArray(m.tool_calls)) {
81 for (const tc of m.tool_calls) {
82 const name = tc.function?.name ?? '';
83 const args = tc.function?.arguments ?? '';
84 if (name === 'shell' || name === 'auto_fix' || name === 'code_run') {
85 didRunShell = true;
86 if (TEST_RUNNER_RE.test(args)) didRunTests = true;
87 }
88 }
89 }
90 // Tool results (tool side) — confirm success (non-error) and scan for test output.
91 if (m.role === 'tool') {
92 const name = m.name ?? '';
93 const content = typeof m.content === 'string' ? m.content : '';
94 const isError = ERROR_PREFIX_RE.test(content);
95 if (EDIT_TOOLS.has(name) && !isError) didSuccessfulEdit = true;
96 if (name === 'shell' || name === 'auto_fix' || name === 'code_run') {
97 didRunShell = true;
98 if (TEST_RUNNER_RE.test(content) || TEST_RESULT_RE.test(content)) didRunTests = true;
99 }
100 }
101 }
102 return { didSuccessfulEdit, didRunTests, didRunShell };
103}
104
105/**
106 * Returns a corrective observation when the final message makes a claim the session

Callers 2

evaluateCompletionFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected