Skip to content

feat: Distribute bssh-server binary alongside bssh via import workflow#11136

Open
Yaminyam wants to merge 3 commits intomainfrom
deps/add-bssh-server-binary
Open

feat: Distribute bssh-server binary alongside bssh via import workflow#11136
Yaminyam wants to merge 3 commits intomainfrom
deps/add-bssh-server-binary

Conversation

@Yaminyam
Copy link
Copy Markdown
Member

Summary

  • Extend .github/workflows/import-bssh.yml so that the automated bssh import workflow also downloads and commits bssh-server-linux-{aarch64,x86_64}-musl binaries whenever a new bssh release is cut. The existing bssh client flow is preserved; a single loop now handles both tools.
  • Update src/ai/backend/agent/agent.py so the agent mounts bssh-server.{arch}.bin into session containers at /opt/kernel/bssh-server (and the manpage at /usr/local/share/man/man1/) with skip_missing=True, so that the binary becomes accessible inside sessions once the import workflow imports it without breaking existing agents that don't have it yet.

Rationale

The bssh upstream project released v2.0.x with a new bssh-server — a Rust-based SSH server for containers supporting SFTP/SCP, PTY/shell, password/pubkey auth, and audit logging. We want to make it available in session containers alongside the existing dropbear-based SSH server for stability and performance evaluation before any decision to replace dropbear is made.

As documented in recent upload-performance measurements (dogbowl, 2026-04-16), dropbear is a single-threaded SSH server that caps SFTP throughput at ~75 MB/s (CPU-bound on 1 core), while OpenSSH on the same container setup reaches ~95 MB/s. bssh-server built with russh is expected to close this gap while keeping the lightweight image footprint. Landing the binary first lets us benchmark it empirically before touching krunner's intrinsic.py.

Test plan

  • Verify the import-bssh workflow run (manual dispatch) downloads both bssh and bssh-server archives for aarch64 and x86_64, extracts the binaries, and creates a PR with bssh.{arch}.bin, bssh-server.{arch}.bin under src/ai/backend/runner/.
  • After the imported binaries land, confirm a new session container has /opt/kernel/bssh-server (via docker exec ... ls -la /opt/kernel/).
  • Confirm dropbear still starts as the default SSH server for session containers (no behavioral regression).

Follow-ups (not in this PR)

  • Wire bssh-server into src/ai/backend/kernel/intrinsic.py as an alternative (flag-driven) SSH server, once it has been manually validated.
  • Decide on a migration plan from dropbear to bssh-server or OpenSSH depending on empirical measurements.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 16, 2026 04:35
@github-actions github-actions bot added size:M 30~100 LoC comp:agent Related to Agent component labels Apr 16, 2026
Yaminyam added a commit that referenced this pull request Apr 16, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends the automated bssh import workflow to also vendor bssh-server release artifacts, and updates the agent’s session container mounts so the new server binary (and manpage) can be made available inside containers once imported.

Changes:

  • Update .github/workflows/import-bssh.yml to download/move both bssh and bssh-server binaries for aarch64/x86_64, and to include bssh-server.1 when present.
  • Update src/ai/backend/agent/agent.py to mount bssh-server.{arch}.bin into session containers at /opt/kernel/bssh-server (and bssh-server.1 into the manpage directory) with skip_missing=True.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/ai/backend/agent/agent.py Adds mounts for bssh-server binary/manpage into session containers.
.github/workflows/import-bssh.yml Generalizes the import workflow to fetch/commit both bssh and bssh-server artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 641 to +649
mount_static_binary("all-smi.1", "/usr/local/share/man/man1/all-smi.1", skip_missing=True)
mount_static_binary(f"bssh.{arch}.bin", "/usr/local/bin/bssh")
mount_static_binary("bssh.1", "/usr/local/share/man/man1/bssh.1", skip_missing=True)
mount_static_binary(
f"bssh-server.{arch}.bin", "/opt/kernel/bssh-server", skip_missing=True
)
mount_static_binary(
"bssh-server.1", "/usr/local/share/man/man1/bssh-server.1", skip_missing=True
)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

skip_missing=True in mount_static_binary() currently only suppresses the FileNotFoundError, but it still appends a bind mount even when the source path does not exist. For Docker/K8s agents this will still fail container startup when bssh-server.{arch}.bin is absent, which defeats the backward-compat intent mentioned in the PR description. Consider changing mount_static_binary() to return early (no mount) when skip_missing is set and resolved_path does not exist, or otherwise ensure the mount source is created as a placeholder before mounting.

Suggested change
mount_static_binary("all-smi.1", "/usr/local/share/man/man1/all-smi.1", skip_missing=True)
mount_static_binary(f"bssh.{arch}.bin", "/usr/local/bin/bssh")
mount_static_binary("bssh.1", "/usr/local/share/man/man1/bssh.1", skip_missing=True)
mount_static_binary(
f"bssh-server.{arch}.bin", "/opt/kernel/bssh-server", skip_missing=True
)
mount_static_binary(
"bssh-server.1", "/usr/local/share/man/man1/bssh-server.1", skip_missing=True
)
if self.resolve_krunner_filepath("runner/all-smi.1").exists():
mount_static_binary("all-smi.1", "/usr/local/share/man/man1/all-smi.1", skip_missing=True)
mount_static_binary(f"bssh.{arch}.bin", "/usr/local/bin/bssh")
if self.resolve_krunner_filepath("runner/bssh.1").exists():
mount_static_binary("bssh.1", "/usr/local/share/man/man1/bssh.1", skip_missing=True)
if self.resolve_krunner_filepath(f"runner/bssh-server.{arch}.bin").exists():
mount_static_binary(
f"bssh-server.{arch}.bin", "/opt/kernel/bssh-server", skip_missing=True
)
if self.resolve_krunner_filepath("runner/bssh-server.1").exists():
mount_static_binary(
"bssh-server.1", "/usr/local/share/man/man1/bssh-server.1", skip_missing=True
)

Copilot uses AI. Check for mistakes.
ls -la "${TARGET_DIR}/${TOOL}.${ARCH}.bin"
done
done
# Move manpages (only bssh currently ships a manpage)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The comment says “only bssh currently ships a manpage”, but the loop now also handles bssh-server.1. Consider updating the comment to reflect the actual behavior (e.g., move manpages if present) to avoid future confusion.

Suggested change
# Move manpages (only bssh currently ships a manpage)
# Move manpages if present

Copilot uses AI. Check for mistakes.
Yaminyam and others added 3 commits April 19, 2026 14:23
- Extend `.github/workflows/import-bssh.yml` to also download, extract,
  and commit `bssh-server-linux-{aarch64,x86_64}-musl` binaries so that
  the newly released bssh v2.0.x server component is available under
  `src/ai/backend/runner/` whenever bssh client updates land.
- Mount the bssh-server binary into session containers at
  `/opt/kernel/bssh-server` (and the manpage under
  `/usr/local/share/man/man1/`) so that it can be exercised for
  stability/performance testing. dropbear remains the default SSH server
  used by krunner; switching over is a separate follow-up.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pants-pinned ruff 0.14.0 collapses the mount line since it fits within
the 100-char limit, while ruff 0.14.6 (local install) kept it wrapped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Yaminyam Yaminyam force-pushed the deps/add-bssh-server-binary branch from eda8bc4 to 0c6cdbc Compare April 19, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:agent Related to Agent component size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants