Skip to content

bug: RepoZip ignores context cancellation during filepath.Walk #232

@claude

Description

@claude

Problem

internal/zip/zip.go:RepoZip (line 152) accepts a context.Context but only passes it to buildGitFileSet (line 163, for the git ls-files subprocess). The filepath.Walk on line 165 has no context awareness — it runs to completion regardless of whether the context is cancelled or timed out.

In cmd/run.go:166, the caller creates a 10-minute timeout context:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()

zipData, skipReport, err := zip.RepoZip(ctx, proj.RootDir)

If the context deadline fires while the walk is in progress (e.g. on a very large repository), the walk continues to completion and the timeout is silently ignored for this phase. The first place the cancellation is actually observed is the subsequent API call.

Fix

Check ctx.Done() inside the filepath.Walk callback in internal/zip/zip.go at the top of the walk function, returning ctx.Err() when cancelled:

err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
    select {
    case <-ctx.Done():
        return ctx.Err()
    default:
    }
    // ... rest of walk
})

Then propagate the context error from RepoZip back to the caller so it can distinguish timeout vs other walk errors.

Files

  • internal/zip/zip.go:165filepath.Walk call with no context check inside callback
  • cmd/run.go:166 — context with 10-minute timeout passed to RepoZip

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions