Skip to content

fix(trace): preselect configured harnesses when re-running trace init - #3548

Merged
migmartri merged 1 commit into
mainfrom
miguel/pfm-7633-trace-init-re-run-does-not-pre-select-the-harnesses-already
Oct 7, 2026
Merged

migmartri merged 1 commit into
mainfrom
miguel/pfm-7633-trace-init-re-run-does-not-pre-select-the-harnesses-already

Conversation

@migmartri

@migmartri migmartri commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Re-running chainloop trace init in a repository that was already set up ticked only Claude Code in the "Harnesses to trace in this repository" prompt, even when the repository also traced Cursor or opencode.

Each trace provider can now report whether its Chainloop hooks are installed in the repository (HooksInstalled). On a re-run, init preselects those harnesses and falls back to Claude Code on a first run. Hooks the user wrote are ignored, a harness configuration that cannot be read is treated as not set up so it cannot stop init, and the repository is only read when the prompt is actually shown. Harness flags and non-interactive runs behave as before.

Fixes PFM-7633

This change was made with AI assistance (Claude Code).

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri

View guided diff

Re-running chainloop trace init ticked only Claude Code in the harness
prompt, even when the repository was already set up for others. Each
provider can now report whether its Chainloop hooks are installed, and
init preselects those harnesses, falling back to Claude Code on a first
run.

Fixes PFM-7633

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: d9398d05-28da-4a58-a25e-31e0ee714c92
@chainloop-platform

chainloop-platform Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 91% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 91% 1 ✅ 0 100% AI / 0% Human 11 +339 / -13 11m50s

🟢 91% — 100% AI — ✅ All policies passing

Oct 7, 2026 12:23 UTC · 11m50s · $10.83 · 408 in / 124.4k out · claude-code 2.1.292 (claude-opus-5-5)

View session details ↗

Change Summary

  • Adds installed-hook detection for claude, cursor, and opencode providers.
  • Pre-selects already-configured harnesses in chainloop trace init, with claude-code as the fallback.
  • Adds regression and provider tests, then updates the related CLI help text and docs.

AI Session Overall Score

🟢 91% — Strong bug-fix session with root-cause work and thorough verification.

AI Session Analysis Breakdown

🟢 96% · verification

🟢 AI added a failing repro, mutation check, and final package test passes. · High Impact

🟢 93% · alignment

No notes.

🟢 91% · solution-quality

🟢 AI fixed missing installed-provider detection instead of papering over prompt defaults. · High Impact

🟢 90% · scope-discipline

🟢 User authorized cleanup separately, and AI left the behavior-changing gap for later. · High Impact

🟢 88% · user-trust-signal

No notes.

🟢 84% · context-and-planning

🟡 The bug-fix session opened from a one-line ticket prompt before richer guidance arrived. · Low Severity


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
modified ai app/cli/cmd/trace_init_providers_test.go +90 / -4
created ai app/cli/internal/trace/providers/hooks_installed_test.go +69 / -0
modified ai app/cli/internal/trace/claude/hooks_test.go +42 / -0
modified ai app/cli/internal/trace/cursor/hooks_test.go +42 / -0
modified ai app/cli/cmd/trace_init_providers.go +33 / -4
modified ai app/cli/internal/trace/claude/hooks.go +20 / -0
modified ai app/cli/internal/trace/cursor/hooks.go +20 / -0
modified ai app/cli/internal/trace/opencode/hooks.go +11 / -0
modified ai app/cli/cmd/trace_init.go +4 / -3
modified ai app/cli/documentation/cli-reference.md +3 / -2
modified ai app/cli/internal/trace/provider.go +5 / -0

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-d9398d -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-d9398d -
✅ Passed ai-config-no-secrets ai-coding-session-d9398d -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-d9398d -

Security Checks — ✅ 5 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 -
Scans not applied (3)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗

Security context

✅ Nothing this change touches has a recorded security-fix history.

View in Chainloop ↗ · How this works ↗


Powered by Chainloop and Chainloop Trace

@migmartri
migmartri requested a review from a team October 7, 2026 13:52
@migmartri
migmartri merged commit 59e741a into main Oct 7, 2026
17 checks passed
@migmartri
migmartri deleted the miguel/pfm-7633-trace-init-re-run-does-not-pre-select-the-harnesses-already branch October 7, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants