Skip to content

fix(attestation): make AI agent config collector deterministic#2911

Merged
jiparis merged 2 commits into
chainloop-dev:mainfrom
jiparis:jiparis/fix-remote-att-materials
Mar 21, 2026
Merged

fix(attestation): make AI agent config collector deterministic#2911
jiparis merged 2 commits into
chainloop-dev:mainfrom
jiparis:jiparis/fix-remote-att-materials

Conversation

@jiparis

@jiparis jiparis commented Mar 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Use attestation InitializedAt timestamp for the AI config CapturedAt field instead of time.Now(), so retries produce identical content and CAS digests
  • Replace RegisterCollectors append semantics with reset to prevent duplicate collectors on repeated calls
  • Move LoadCraftingState inside the per-collector loop so each collector operates on the latest remote state

Fixes PFM-5122

@jiparis jiparis requested review from javirln and migmartri March 21, 2026 17:08

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/crafter.go">

<violation number="1" location="pkg/attestation/crafter/crafter.go:148">
P2: Returning on reload failure inside the collector loop aborts remaining collectors and breaks the function’s best-effort contract.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread pkg/attestation/crafter/crafter.go Outdated
Use attestation InitializedAt timestamp for CapturedAt instead of
time.Now(), ensuring the same content is produced on retries. Also
replace RegisterCollectors append with reset to prevent duplicate
collectors, and move LoadCraftingState inside the per-collector loop
so each collector sees the latest state.

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
@jiparis jiparis force-pushed the jiparis/fix-remote-att-materials branch from 4cefee5 to 954221e Compare March 21, 2026 17:10
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
@jiparis jiparis merged commit caa231e into chainloop-dev:main Mar 21, 2026
15 checks passed
@jiparis jiparis deleted the jiparis/fix-remote-att-materials branch March 21, 2026 17:34
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