Repository navigation
Conversation
Recompute Pi v2 totals from native input and output counters, preserve cache categories, and verify them against cache-active raw session records. Assisted-by: Vibhav's Pi Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Retain the existing Chainloop evidence version while normalizing Pi cache counters. Clarify that agent releases and evidence versions are distinct. Assisted-by: Vibhav's Pi Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Compare Pi usage with the native session records regardless of the Chainloop evidence version; only Codex requires its v2 accounting guard. Assisted-by: Vibhav's Pi Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Run chainloop trace init after the Pi provider support: guard the generated Claude Code and Cursor hook commands so they no-op when the CLI is missing, add the managed Pi extension reference copy, and teach the OpenCode plugin the OpenCode 2.x tool-result shape. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
PR validation —
|
| Status | Policy | Material | Messages |
|---|---|---|---|
pr-min-approvals |
pr-info |
PR/MR #3731 has 0 approving reviews, 1 required. | |
| ✅ Passed | pr-description-required |
pr-info |
- |
| ✅ Passed | pr-user-story-linked |
pr-info |
- |
AI Session Checks — ⚠️ no AI session found
Missing AI Coding Sessions
This organization requires every PR to be backed by a Chainloop Trace AI coding session, and none was found for this one.
Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.
Learn more about Chainloop Trace.
Security Checks — ✅ 6 passing
✅ secret-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
✅ iac-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | iac-misconfiguration |
- |
Scans not applied (2)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
Security context
✅ Nothing this change touches has a recorded security-fix history.
View in Chainloop ↗ · How this works ↗
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
2 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".pi/extensions/chainloop-trace.ts">
<violation number="1" location=".pi/extensions/chainloop-trace.ts:101">
P3: The stderr buffering in `runHook` is never read, and its overflow kills the hook. Discard stderr instead of buffering it, so a noisy stderr cannot SIGTERM the process and drop its stdout response.</violation>
<violation number="2" location=".pi/extensions/chainloop-trace.ts:146">
P2: Banner-only session-start responses are not cached, so every `before_agent_start` invokes session-start again and repeats the banner and its auth/network work on every turn. Cache any successful session-start response, not only responses containing `instruction`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| const start = async (ctx, hookEventName) => { | ||
| const id = sessionID(ctx) | ||
| const response = await runHook(ctx, "session-start", hookPayload(ctx, hookEventName)) | ||
| if (response?.instruction) starts.set(id, response) |
There was a problem hiding this comment.
P2: Banner-only session-start responses are not cached, so every before_agent_start invokes session-start again and repeats the banner and its auth/network work on every turn. Cache any successful session-start response, not only responses containing instruction.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .pi/extensions/chainloop-trace.ts, line 146:
<comment>Banner-only session-start responses are not cached, so every `before_agent_start` invokes session-start again and repeats the banner and its auth/network work on every turn. Cache any successful session-start response, not only responses containing `instruction`.</comment>
<file context>
@@ -0,0 +1,246 @@
+ const start = async (ctx, hookEventName) => {
+ const id = sessionID(ctx)
+ const response = await runHook(ctx, "session-start", hookPayload(ctx, hookEventName))
+ if (response?.instruction) starts.set(id, response)
+ showBanner(ctx, response)
+ return response
</file context>
| if (response?.instruction) starts.set(id, response) | |
| if (response?.instruction || response?.banner) starts.set(id, response) |
| } | ||
|
|
||
| child.stdout.on("data", (chunk) => { stdoutBytes = capture(stdout, chunk, stdoutBytes) }) | ||
| child.stderr.on("data", (chunk) => { stderrBytes = capture(stderr, chunk, stderrBytes) }) |
There was a problem hiding this comment.
P3: The stderr buffering in runHook is never read, and its overflow kills the hook. Discard stderr instead of buffering it, so a noisy stderr cannot SIGTERM the process and drop its stdout response.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .pi/extensions/chainloop-trace.ts, line 101:
<comment>The stderr buffering in `runHook` is never read, and its overflow kills the hook. Discard stderr instead of buffering it, so a noisy stderr cannot SIGTERM the process and drop its stdout response.</comment>
<file context>
@@ -0,0 +1,246 @@
+ }
+
+ child.stdout.on("data", (chunk) => { stdoutBytes = capture(stdout, chunk, stdoutBytes) })
+ child.stderr.on("data", (chunk) => { stderrBytes = capture(stderr, chunk, stderrBytes) })
+ child.on("error", () => {
+ exited = true
</file context>
| child.stderr.on("data", (chunk) => { stderrBytes = capture(stderr, chunk, stderrBytes) }) | |
| child.stderr.resume() |
Summary
total_tokensis recomputed as base input + output, excluding both cache categories. Cost stays authoritative from the session. Invalid or overflowing counters are ignored with deterministic warnings.schema_versionatv1and stop gating the cache-accounting checks on the schema version..pi/extensions/chainloop-trace.ts) and teach the OpenCode plugin the OpenCode 2.x tool-result shape.Refs #3704 (Pi provider support).
Assisted-by: Claude Code