@raytrace-cli/cli 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytrace-cli/cli",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "See what your coding agent did: traces, tool calls, cost and step-by-step evidence for Claude Code and Codex.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -557,6 +557,10 @@ export function openEvidenceStore(file, { readOnly = false } = {}) {
557
557
  insertAttribution.run(randomUUID(), toolCallId, eventId, method, confidence,
558
558
  JSON.stringify({ method, score, window_start_ms: windowStartMs, window_end_ms: windowEndMs }), ATTRIBUTOR_VERSION, Date.now(),
559
559
  score ?? null, windowStartMs ?? null, windowEndMs ?? null);
560
+ // The process may have exited and the call been answered before the two
561
+ // were tied (a transcript that arrives after its commands ran): neither
562
+ // arrival will come again to set the check.
563
+ checkReported({ toolCallId });
560
564
  indexGuarded(() => indexCall(toolCallId));
561
565
  return true;
562
566
  },
@@ -208,6 +208,16 @@ test('a result with no code and no error agrees with an observed exit 0, and is
208
208
  });
209
209
  });
210
210
 
211
+ test('reported_check is set when a process is tied to its call after both have finished', () => withStore((store) => {
212
+ // The command ran and exited before its call was recorded, as a transcript that arrives late leaves it.
213
+ const top = store.recordProcessStart({ containerId: CONTAINER, projectId: SESSION, raw: exec(1, 108, 10, ['/bin/bash', '-c', 'ls /nope'], '1000', 1_790_000_000_500), startedMs: 1_790_000_000_500 });
214
+ store.recordProcessExit({ containerId: CONTAINER, raw: exit(2, 108, '1000', 2, 1_790_000_000_600), endedMs: 1_790_000_000_600, exit_code: 2 });
215
+ captureDemo(store, { reported: HEADER(2, 0.1) });
216
+ const [candidate] = store.candidatesInWindow(0, Number.MAX_SAFE_INTEGER, { sessionId: SESSION });
217
+ store.attribute({ toolCallId: candidate.call_id, eventId: top.eventId, method: 'marker', confidence: 'exact', score: 1 });
218
+ assert.equal(one(store, "SELECT reported_check FROM runtime_attributions WHERE method = 'marker'").reported_check, 'agrees');
219
+ }));
220
+
211
221
  test('attributionsForProcesses marks own, inherited and unattributed processes by pid + start time', () => withStore((store) => {
212
222
  captureDemo(store);
213
223
  observeDemo(store);
@@ -86,6 +86,12 @@ export function toExecutionEvent(event, clock = UNMEASURED_CLOCK) {
86
86
  const pid = Number(event.pid);
87
87
  const eventId = Number(event.event_id);
88
88
  if (!command || timestamp == null || !Number.isFinite(pid) || !Number.isFinite(eventId)) return null;
89
+ // The hook announcing a file tool's call to the sandbox's recorder
90
+ // (worker/sandbox/claude-hook.mjs announce()): /bin/true, carrying the call
91
+ // id. It is not a process the call ran, and recording it would tie every
92
+ // Read, Write and Edit to a `true` that exited 0. Only the real `true` is
93
+ // left out: any other program given these arguments is recorded as usual.
94
+ if (argv[1] === 'raytrace-tool' && /^(?:\/usr)?\/bin\/true$/.test(String(event.executable ?? ''))) return null;
89
95
  // `markers` is the collector's allowlisted RAYTRACE_* env (see
90
96
  // worker/gvisor/collector.py MARKER_KEYS). When RAYTRACE_CALL_ID is present
91
97
  // it IS the answer -- the call id travelled with the process -- and the
@@ -433,3 +433,11 @@ test('a source checkpoint failure does not reject the background poll and retrie
433
433
  const forwarder=startGvisorForwarder({ingest:async()=>new Map(),finish:()=>{},fetchImpl,log:()=>{},saveProgress:async()=>{if(fail)throw Error('disk full');saved++;},pollMs:60000,discoverMs:60000});
434
434
  try{await forwarder.discover();await assert.doesNotReject(forwarder.poll());fail=false;await forwarder.poll();assert.equal(saved,1);}finally{forwarder.stop();}
435
435
  });
436
+
437
+ test('the hook announcing a file tool call is not a process of that call', () => {
438
+ const announce = { ...exec(7, 300, 299, ['true', 'raytrace-tool', 'begin', 'Read', 'src/app.js']), executable: '/usr/bin/true', markers: { RAYTRACE_CALL_ID: 'toolu_1' } };
439
+ assert.equal(toExecutionEvent(announce), null);
440
+ // Any other program given the same arguments is a process like any other.
441
+ assert.equal(toExecutionEvent({ ...announce, executable: '/workspace/true' }).call_marker, 'toolu_1');
442
+ assert.equal(toExecutionEvent({ ...announce, argv: ['true', 'something-else'] }).call_marker, 'toolu_1');
443
+ });