Skip to content

fix(#7298): pre-provision pre-commit hook envs and add golangci-lint to code sandbox - #7344

Open
SIDDHESH1564 wants to merge 3 commits into
fullsend-ai:mainfrom
SIDDHESH1564:fix/7298-sandbox-precommit-golangci-lint
Open

SIDDHESH1564 wants to merge 3 commits into
fullsend-ai:mainfrom
SIDDHESH1564:fix/7298-sandbox-precommit-golangci-lint

Conversation

@SIDDHESH1564

@SIDDHESH1564 SIDDHESH1564 commented Sep 16, 2026

Copy link
Copy Markdown

Summary

Pre-provisions pre-commit hook environments at image-build time and adds golangci-lint to the fullsend-code sandbox, eliminating the recurring HTTP 403 failure that forced every code/fix agent run to manually re-implement hook checks.

Related Issue

Closes #7298

Changes

  • images/code/Containerfile — set PRE_COMMIT_HOME=/sandbox/pre-commit-cache, create the directory (sandbox-user-owned), COPY the seed config, install golangci-lint via go install (as sandbox user, same pattern as gopls), run pre-commit install-hooks against the seed config in a throwaway git repo so all 7 external hook environments are baked in at build time
  • images/code/pre-commit-seed.yaml — new seed config listing the 7 external repos at their pinned revs (matching .pre-commit-config.yaml); local hooks are excluded since they require the checked-out workspace
  • .github/workflows/sandbox-images.yml — smoke test now asserts golangci-lint is at /sandbox/go/bin/golangci-lint and PRE_COMMIT_HOME is a non-empty directory
  • docs/contributing/sandbox-topology.md — update fullsend-code key-additions row to include golangci-lint and the pre-commit hook cache

Testing

  • go vet ./... passes (no Go production code changed)
  • YAML syntax validated on sandbox-images.yml and pre-commit-seed.yaml
  • Containerfile layer ordering reviewed: PRE_COMMIT_HOME env and directory creation run as root before USER sandbox; golangci-lint install and pre-commit install-hooks run as sandbox user after the Go toolchain is on PATH

Checklist

  • PR title follows Conventional Commits (fix(#7298):)
  • Commits are signed off (DCO) — Signed-off-by: Siddhesh Khairnar <khairnarsiddhesh4057@gmail.com>
  • I wrote this contribution myself and can explain all changes in it

…angci-lint to code sandbox

The code/fix agent sandbox blocks outbound git-over-HTTPS at runtime
(HTTP 403), so `pre-commit install-hooks` cannot clone the seven
external hook repos declared in .pre-commit-config.yaml. Every affected
agent run worked around this by manually invoking each hook's underlying
tool individually — a list that silently drifts whenever .pre-commit-config.yaml
changes.

This commit addresses both root causes identified in fullsend-ai#7298:

1. Pre-provision pre-commit hook environments at image-build time.
   A new seed config (images/code/pre-commit-seed.yaml) lists the seven
   external repos at their pinned revs. During the code image build,
   `pre-commit install-hooks` clones each repo and builds its Python venv
   or Go binary into PRE_COMMIT_HOME=/sandbox/pre-commit-cache. At
   runtime the cache is already populated, so `pre-commit run` requires
   no outbound git fetch. The directory is sandbox-user-owned so the
   agent can extend it if hook revs change between image rebuilds.

2. Install golangci-lint into the code image.
   Agents trying to run `golangci-lint` at runtime hit the network block
   and timed out. golangci-lint is now installed via `go install` as the
   sandbox user (landing in /sandbox/go/bin, already on PATH) alongside
   the existing gopls install.

Also adds two smoke-test assertions to sandbox-images.yml CI:
golangci-lint must be at /sandbox/go/bin/golangci-lint, and
PRE_COMMIT_HOME must be a non-empty directory.

Updates docs/contributing/sandbox-topology.md to reflect the new tools.

Signed-off-by: Siddhesh Khairnar <khairnarsiddhesh4057@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@SIDDHESH1564
SIDDHESH1564 requested a review from a team as a code owner September 16, 2026 06:54
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

1 similar comment
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Pre-provision sandbox hooks and golangci-lint

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Pre-build external pre-commit environments to avoid runtime network failures.
• Install golangci-lint in the code sandbox for offline linting.
• Validate and document the sandbox’s new tools and cache.
Diagram

graph TD
  CI["Image Build"] --> BUILD["Code Container"] --> CACHE[("Hook Cache")] --> AGENT["Code Agents"]
  SEED["Seed Config"] --> BUILD
  REPOS["Hook Repos"] --> BUILD
  MODULES["Go Modules"] --> BUILD
  BUILD --> LINT["golangci-lint"] --> AGENT
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Build from the root pre-commit configuration
  • ➕ Eliminates duplicated repository revisions and hook definitions
  • ➕ Prevents the seed configuration from drifting silently
  • ➖ Requires widening or restructuring the Docker build context
  • ➖ Root configuration includes local hooks that cannot all be prepared in the image
  • ➖ Unrelated repository changes could invalidate image build caching
2. Permit runtime hook repository egress
  • ➕ Uses the authoritative workspace configuration directly
  • ➕ Automatically supports newly added or updated external hooks
  • ➖ Weakens sandbox network restrictions
  • ➖ Makes agent runs dependent on external service availability
  • ➖ Repeats downloads and environment creation across runs

Recommendation: Keep build-time provisioning because it preserves runtime isolation and makes hook execution reliable. The dedicated seed configuration is pragmatic with the current narrow Docker context, but a future synchronization check against .pre-commit-config.yaml would reduce revision-drift risk.

Files changed (4) +88 / -1

Bug fix (1) +43 / -0
ContainerfileBake lint tooling and hook environments into the image +43/-0

Bake lint tooling and hook environments into the image

• Defines a sandbox-owned PRE_COMMIT_HOME, installs pinned golangci-lint as the sandbox user, and prepares external pre-commit environments in a temporary Git repository during image construction. This avoids runtime installs and clones blocked by sandbox egress policy.

images/code/Containerfile

Tests (1) +3 / -0
sandbox-images.ymlValidate sandbox linter and hook cache +3/-0

Validate sandbox linter and hook cache

• Extends the code-image smoke test to verify golangci-lint resolves from '/sandbox/go/bin'. It also confirms PRE_COMMIT_HOME exists and contains pre-provisioned hook data.

.github/workflows/sandbox-images.yml

Documentation (1) +1 / -1
sandbox-topology.mdDocument new fullsend-code tooling +1/-1

Document new fullsend-code tooling

• Adds golangci-lint and the PRE_COMMIT_HOME hook cache to the documented additions provided by the fullsend-code image.

docs/contributing/sandbox-topology.md

Other (1) +41 / -0
pre-commit-seed.yamlDefine external hooks for image pre-provisioning +41/-0

Define external hooks for image pre-provisioning

• Adds a build-only pre-commit configuration containing the seven external repositories and revisions used by the root configuration. Local workspace-dependent hooks are intentionally excluded.

images/code/pre-commit-seed.yaml

@qodo-code-review

qodo-code-review Bot commented Sep 16, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Code sandbox images fail to build 🐞 Bug ≡ Correctness
Description
COPY creates /tmp/pre-commit-seed.yaml as root, but the final pre-commit RUN executes after
USER sandbox and tries to remove that file. With the inherited sticky /tmp, the non-owner unlink
returns an error, so the final && rm -rf makes both architecture builds fail after hook
installation.
Code

images/code/Containerfile[199]

+    && rm -rf /tmp/pre-commit-seed-repo /tmp/pre-commit-seed.yaml
Relevance

●●● Strong

This is a deterministic Docker build failure: sandbox cannot unlink the root-owned sticky-/tmp seed
file.

PR-#286

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Containerfile runs as root when the unqualified COPY creates the seed, switches to the sandbox
user, and then chains removal of that root-owned file into the hook-installation layer. Docker
copies files as root without --chown, while sticky-directory semantics prevent another user from
unlinking them.

images/code/Containerfile[26-26]
images/code/Containerfile[148-160]
images/code/Containerfile[195-199]
images/sandbox/Containerfile[33-37]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The pre-commit seed is copied as root but removed by the sandbox user from sticky `/tmp`, causing the image build to fail during cleanup.

## Fix Focus Areas
- images/code/Containerfile[150-150]
- images/code/Containerfile[195-199]

## Recommended Fix
Copy the seed with `--chown=sandbox:sandbox` before switching users, or perform its cleanup in a root-owned build step. Preserve failure propagation from `pre-commit install-hooks` while ensuring the sandbox user can remove every temporary path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Hook updates leave agents offline 🐞 Bug ⚙ Maintainability
Description
pre-commit-seed.yaml duplicates every external repository and revision from
.pre-commit-config.yaml, but its only synchronization mechanism is a comment and the smoke test
merely checks that the cache is non-empty. When an external hook is added or bumped only in the
authoritative root configuration, the stale cache still passes validation and runtime pre-commit
attempts the blocked Git clone for the absent entry.
Code

images/code/pre-commit-seed.yaml[R12-13]

+# Keep revs in sync with the root .pre-commit-config.yaml.
+# A mismatch causes pre-commit to re-clone at runtime — defeating the purpose.
Relevance

●●● Strong

The duplicated hook source needs executable synchronization enforcement, not merely a keep-in-sync
comment.

PR-#1714

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The root configuration and seed maintain separate external-repository lists, while the new smoke
assertions only establish that some cache content exists. No checked synchronization mechanism
ensures that all authoritative entries remain represented, matching the repository's previously
accepted need for explicit synchronization enforcement between duplicated sources.

images/code/pre-commit-seed.yaml[12-41]
.pre-commit-config.yaml[3-77]
.github/workflows/sandbox-images.yml[161-163]
PR-#1714

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The independently maintained seed can drift from the root pre-commit configuration without any CI or image smoke-test failure, restoring the runtime network failure this change is intended to eliminate.

## Fix Focus Areas
- images/code/pre-commit-seed.yaml[12-13]
- .pre-commit-config.yaml[3-77]
- .github/workflows/sandbox-images.yml[161-163]

## Recommended Fix
Add a checked script or test that parses both YAML files and fails unless every external repository, revision, and environment-affecting hook setting is represented in the seed. Run that check in normal CI or the image workflow so a root hook update cannot merge without the corresponding seed update.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Sandbox workflow lacks guide review 📘 Rule violation § Compliance
Description
sandbox-images.yml adds three smoke-test assertions, but neither those changes nor the PR
description states that docs/contributing/ci-workflows.md was consulted. The omission is triggered
by this workflow modification and leaves the new image-validation step without the explicit review
evidence required for GitHub Actions changes.
Code

.github/workflows/sandbox-images.yml[R161-163]

+            [ "$(command -v golangci-lint)" = "/sandbox/go/bin/golangci-lint" ] || { echo "FAIL: golangci-lint not at expected path ($(command -v golangci-lint))"; exit 1; }
+            [ -d "$PRE_COMMIT_HOME" ] || { echo "FAIL: PRE_COMMIT_HOME ($PRE_COMMIT_HOME) not a directory"; exit 1; }
+            [ -n "$(ls -A "$PRE_COMMIT_HOME" 2>/dev/null)" ] || { echo "FAIL: PRE_COMMIT_HOME ($PRE_COMMIT_HOME) is empty — hook pre-population failed"; exit 1; }
Relevance

●●● Strong

Workflow-guide compliance requirements are enforced for GitHub Actions changes; this PR provides no
consultation evidence.

PR-#7093

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 3201588 requires explicit evidence that the CI workflow guide was consulted when a
GitHub Actions workflow is modified. Lines 161-163 modify the sandbox workflow, while neither the
added code nor the supplied PR description references that guide.

Rule 3201588: Consult CI workflow guide when modifying GitHub Actions workflows or secrets
.github/workflows/sandbox-images.yml[161-163]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sandbox image workflow was modified without explicit evidence that `docs/contributing/ci-workflows.md` was consulted.

## Fix Focus Areas
- .github/workflows/sandbox-images.yml[161-163]

## Recommended Fix
Add an adjacent YAML comment stating that `docs/contributing/ci-workflows.md` was consulted and that this change only extends the existing smoke-test assertions without changing secrets, contexts, or workflow structure.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 70 rules
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/agents (sha: 69ade99f)
Review mode: ⚖️ Balanced: This changes container build behavior, pre-commit caching, tool installation, and CI smoke tests across multiple execution contexts, creating meaningful configuration and reproducibility risk but not enough independent logic for extended review.

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +161 to +163
[ "$(command -v golangci-lint)" = "/sandbox/go/bin/golangci-lint" ] || { echo "FAIL: golangci-lint not at expected path ($(command -v golangci-lint))"; exit 1; }
[ -d "$PRE_COMMIT_HOME" ] || { echo "FAIL: PRE_COMMIT_HOME ($PRE_COMMIT_HOME) not a directory"; exit 1; }
[ -n "$(ls -A "$PRE_COMMIT_HOME" 2>/dev/null)" ] || { echo "FAIL: PRE_COMMIT_HOME ($PRE_COMMIT_HOME) is empty — hook pre-population failed"; exit 1; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. Sandbox workflow lacks guide review 📘 Rule violation § Compliance

sandbox-images.yml adds three smoke-test assertions, but neither those changes nor the PR
description states that docs/contributing/ci-workflows.md was consulted. The omission is triggered
by this workflow modification and leaves the new image-validation step without the explicit review
evidence required for GitHub Actions changes.
Agent Prompt
## Issue description
The sandbox image workflow was modified without explicit evidence that `docs/contributing/ci-workflows.md` was consulted.

## Fix Focus Areas
- .github/workflows/sandbox-images.yml[161-163]

## Recommended Fix
Add an adjacent YAML comment stating that `docs/contributing/ci-workflows.md` was consulted and that this change only extends the existing smoke-test assertions without changing secrets, contexts, or workflow structure.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread images/code/Containerfile
&& cd /tmp/pre-commit-seed-repo \
&& pre-commit install-hooks -c /tmp/pre-commit-seed.yaml \
&& cd / \
&& rm -rf /tmp/pre-commit-seed-repo /tmp/pre-commit-seed.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Code sandbox images fail to build 🐞 Bug ≡ Correctness

COPY creates /tmp/pre-commit-seed.yaml as root, but the final pre-commit RUN executes after
USER sandbox and tries to remove that file. With the inherited sticky /tmp, the non-owner unlink
returns an error, so the final && rm -rf makes both architecture builds fail after hook
installation.
Agent Prompt
## Issue description
The pre-commit seed is copied as root but removed by the sandbox user from sticky `/tmp`, causing the image build to fail during cleanup.

## Fix Focus Areas
- images/code/Containerfile[150-150]
- images/code/Containerfile[195-199]

## Recommended Fix
Copy the seed with `--chown=sandbox:sandbox` before switching users, or perform its cleanup in a root-owned build step. Preserve failure propagation from `pre-commit install-hooks` while ensuring the sandbox user can remove every temporary path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +12 to +13
# Keep revs in sync with the root .pre-commit-config.yaml.
# A mismatch causes pre-commit to re-clone at runtime — defeating the purpose.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

3. Hook updates leave agents offline 🐞 Bug ⚙ Maintainability

pre-commit-seed.yaml duplicates every external repository and revision from
.pre-commit-config.yaml, but its only synchronization mechanism is a comment and the smoke test
merely checks that the cache is non-empty. When an external hook is added or bumped only in the
authoritative root configuration, the stale cache still passes validation and runtime pre-commit
attempts the blocked Git clone for the absent entry.
Agent Prompt
## Issue description
The independently maintained seed can drift from the root pre-commit configuration without any CI or image smoke-test failure, restoring the runtime network failure this change is intended to eliminate.

## Fix Focus Areas
- images/code/pre-commit-seed.yaml[12-13]
- .pre-commit-config.yaml[3-77]
- .github/workflows/sandbox-images.yml[161-163]

## Recommended Fix
Add a checked script or test that parses both YAML files and fails unless every external repository, revision, and environment-affecting hook setting is represented in the seed. Run that check in normal CI or the image workflow so a root hook update cannot merge without the corresponding seed update.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

Code/fix agent sandbox can't fetch pre-commit hook repos (HTTP 403), forcing manual per-hook reimplementation every run

1 participant