Skip to content

[plan] Create helper script to dynamically detect and mount required libraries #12379

@github-actions

Description

@github-actions

Objective

Implement a shell script that dynamically detects library dependencies for mounted binaries and generates appropriate Docker mount arguments.

Context

Mounting entire library directories (/usr/lib, /lib, /lib64) increases the container size and security surface. A smarter approach is to:

  1. Detect what libraries the mounted binaries actually need
  2. Generate minimal mount commands for only those libraries
  3. Cache results for performance

Approach

  1. Create scripts/detect-library-deps.sh that:
    • Takes a list of binaries as input
    • Uses ldd to find library dependencies
    • Outputs Docker mount arguments (e.g., -v /lib/x86_64-linux-gnu/libc.so.6:/lib/x86_64-linux-gnu/libc.so.6:ro)
    • Handles symlinks and library versioning
  2. Add caching mechanism to avoid repeated ldd calls
  3. Integrate into engine execution code paths
  4. Add tests to verify library detection accuracy

Files to Create/Modify

  • Create: scripts/detect-library-deps.sh (library detection script)
  • Create: scripts/detect-library-deps_test.sh (test script)
  • Modify: pkg/workflow/copilot_engine_execution.go (use script output)
  • Modify: pkg/workflow/claude_engine.go (use script output)
  • Modify: pkg/workflow/codex_engine.go (use script output)

Acceptance Criteria

  • Script correctly identifies all library dependencies for given binaries
  • Script handles symlinks and library versions properly
  • Caching reduces repeated detection overhead
  • Integration with engines works across copilot/claude/codex
  • Tests verify accuracy for common utilities (curl, jq, git)

Related

Implements dynamic solution proposed in #11972
Related to #11970

AI generated by Plan Command for #11970

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions