Skip to content

Regression in #1068: CONFIG_DIR check re-introduced in zip stage, drops top-level agentcore Python packages from deployment artifact #1408

@brianloyal

Description

@brianloyal

Summary

PR #1015 (#d1e52411) correctly removed the CONFIG_DIR exclusion check from the zip-stage functions (collectFiles / collectFilesSync) because the zip operates on the staging directory — not the project root — and the project config directory is already absent from staging by the time zipping begins.

PR #1068 (#9ccf802e, "evo preview features" merge) re-introduced that check due to a merge conflict resolution that took the wrong side. The check is currently present on `main`.

Affected code

File: `src/lib/packaging/helpers.ts`

Lines 206 and 407 (both `collectFiles` and `collectFilesSync`) currently contain:

```typescript
if (entry.name === CONFIG_DIR && resolve(directory) === resolve(rootDir)) continue;
```

where `rootDir` equals `stagingDir` (passed from `createZipFromDir(stagingDir, ...)`).

Impact

Any Python package that installs a top-level module named `agentcore` (i.e., places `staging/agentcore/` directly in the staging directory) will have that module silently excluded from the deployment zip.

This is distinct from the original issue #843 / #902, which affected nested `agentcore` subdirectories via the flat `EXCLUDED_ENTRIES` set. That bug was fixed by PR #844. The current regression only affects a top-level `agentcore` Python package — a less common case — but still incorrect behavior.

Root cause

The zip stage should never exclude the project config directory because:

  1. The config directory lives at `/agentcore/` — NOT inside `stagingDir`
  2. The copy stage (`copySourceTree`) already filters it out at the source before writing to staging
  3. `uv pip install --target stagingDir` populates staging with third-party packages only

There is no `agentcore/` config directory in staging, so the check is both unnecessary and harmful.

Fix

Restore the state from PR #1015 — remove the `CONFIG_DIR` check from `collectFiles` and `collectFilesSync`, and remove the now-unused `rootDir` parameter from those functions:

```diff
-async function collectFiles(directory: string, rootDir: string, basePath = ''): Promise {
+async function collectFiles(directory: string, basePath = ''): Promise {
const result: Zippable = {};
const entries = await readdir(directory, { withFileTypes: true });

for (const entry of entries) {
if (EXCLUDED_ENTRIES.has(entry.name)) continue;

  • if (entry.name === CONFIG_DIR && resolve(directory) === resolve(rootDir)) continue;

    const fullPath = join(directory, entry.name);
    const zipPath = basePath ? `${basePath}/${entry.name}` : entry.name;

    if (entry.isDirectory()) {

  •  Object.assign(result, await collectFiles(fullPath, rootDir, zipPath));
    
  •  Object.assign(result, await collectFiles(fullPath, zipPath));
    
    } else if (entry.isFile()) {
    result[zipPath] = [await readFile(fullPath), { level: 6 }];
    }
    }
    return result;
    }
    ```

Same change for `collectFilesSync`, and remove the extra argument in the callers `createZipFromDir` and `createZipFromDirSync`.

The existing test suite (`helpers.test.ts`, issue #843 describe block) already validates that nested `agentcore/` directories are preserved — those tests should continue to pass. The zip-stage tests should also be updated to reflect that `createZipFromDir` no longer excludes anything by `CONFIG_DIR` name (it already receives a clean staging directory).

Commit history

Commit Description
`c3921ec0` PR #844 — removed `'agentcore'` from flat `EXCLUDED_ENTRIES`, added root-only `CONFIG_DIR` check in both copy and zip stages
`d1e52411` PR #1015 — removed `CONFIG_DIR` check from zip stage (correct)
`9ccf802e` PR #1068re-introduced `CONFIG_DIR` check in zip stage (regression)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions