Skip to content

fix(agent): run execute hook on initial render - #347

Open
CoderSufiyan wants to merge 1 commit into
Infisical:mainfrom
CoderSufiyan:fix/agent-execute-on-initial-render
Open

fix(agent): run execute hook on initial render#347
CoderSufiyan wants to merge 1 commit into
Infisical:mainfrom
CoderSufiyan:fix/agent-execute-on-initial-render

Conversation

@CoderSufiyan

Copy link
Copy Markdown

Description 📣

Fixes #340.

Run the configured post-render execute hook after every successful template render, including the first render after an agent restart. This ensures applications reload when a rotated secret is written while the agent is offline.

No new dependencies.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

go test -vet=off ./packages/cmd
go build ./...

The focused regression test verifies that an initial literal-template render executes the configured command. Standard go test ./packages/cmd is currently blocked by pre-existing vet findings in packages/cmd/run.go.


@infisical-cla-app

Copy link
Copy Markdown

📝 Contributor License Agreement required

Before this PR can merge, every contributor must sign the Infisical CLA.
Signing is quick: sign in with GitHub, review the CLA, and accept.

👉 Sign the CLA

Still needs to sign:

Once everyone has signed, the check updates automatically — no need to close and reopen the PR.

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR runs a template’s configured execute hook after the initial successful render, matching its behavior on subsequent changed renders.

  • Removes the first-run exclusion from the execute-hook condition.
  • Adds a regression test covering initial literal-template rendering and command execution.

Confidence Score: 5/5

The PR appears safe to merge with the initial execute-hook behavior covered by a focused regression test.

The changed condition reuses the existing post-render command path on the first successful render, and the added test verifies both execution and clean monitor cancellation without introducing a security boundary change.

Important Files Changed

Filename Overview
packages/cmd/agent.go Extends the existing post-render execute-hook path to the initial successful template render; no actionable defect was identified.
packages/cmd/agent_execute_test.go Adds focused coverage confirming the initial render writes its template and invokes the configured command.

Reviews (1): Last reviewed commit: "fix(agent): run execute hook on initial ..." | Re-trigger Greptile

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.

agent: post-render execute hook never runs on the first render after a restart

1 participant