Skip to content

Fix cross-resource s3_copy and AWS config resolution - #462

Open
PeterSu92 wants to merge 1 commit into
masterfrom
fix/wb-mcp-s3-copy-recursive
Open

Fix cross-resource s3_copy and AWS config resolution#462
PeterSu92 wants to merge 1 commit into
masterfrom
fix/wb-mcp-s3-copy-recursive

Conversation

@PeterSu92

Copy link
Copy Markdown
Contributor

Discovered during BENCH-9837 work.

The s3_copy tool could not do a recursive cross-resource copy, and every AWS-backed tool could silently use the wrong workspace's credentials.

This PR:

  • Copies recursive cross-resource transfers one object at a time. The previous code passed a temp FILE as the destination of aws s3 cp --recursive, which requires a directory, so recursive cross-profile copies always failed. Per-object staging also bounds disk use to the largest single object instead of the whole prefix, which can exceed the staging filesystem.
  • Resolves the workspace lazily in ensureAWSConfig via getCurrentWorkspaceUUID(). It previously read cachedWorkspaceUUID, which is only filled at startup, so a workspace set after the server booted left it empty.
  • Removes the fallback that returned an arbitrary .conf from ~/.workbench/aws. Those belong to other workspaces, and their profiles resolve to the wrong resources, surfacing as a confusing "config profile could not be found".
  • Passes --wb-path when generating the AWS config, so credential_process points at the wb binary in use rather than a path that may not exist.
  • Adds WB_MCP_STAGE_DIR to relocate copy staging off the default temp filesystem, which is a small overlay on some images.

The s3_copy tool could not do a recursive cross-resource copy, and every
AWS-backed tool could silently use the wrong workspace's credentials.

This PR:
- Copies recursive cross-resource transfers one object at a time. The
  previous code passed a temp FILE as the destination of
  `aws s3 cp --recursive`, which requires a directory, so recursive
  cross-profile copies always failed. Per-object staging also bounds disk
  use to the largest single object instead of the whole prefix, which can
  exceed the staging filesystem.
- Resolves the workspace lazily in ensureAWSConfig via
  getCurrentWorkspaceUUID(). It previously read cachedWorkspaceUUID, which
  is only filled at startup, so a workspace set after the server booted
  left it empty.
- Removes the fallback that returned an arbitrary .conf from
  ~/.workbench/aws. Those belong to other workspaces, and their profiles
  resolve to the wrong resources, surfacing as a confusing "config profile
  could not be found".
- Passes --wb-path when generating the AWS config, so credential_process
  points at the wb binary in use rather than a path that may not exist.
- Adds WB_MCP_STAGE_DIR to relocate copy staging off the default temp
  filesystem, which is a small overlay on some images.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@PeterSu92
PeterSu92 requested review from NBBense and anshisax August 20, 2026 00:20
@PeterSu92
PeterSu92 requested review from a team as code owners August 20, 2026 00:20
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.

1 participant