Repository navigation
feat(box): expose run command as library - #116
gautamsirdeshmukh merged 11 commits into
Conversation
## Problem Boxy cannot call the Box run command from Rust because strands-box has no library target. ## Solution Expose run(PathBuf) -> ExitCode and cli_main() -> ExitCode at the crate root. Keep the composition modules private. Both entry points use the existing hardening, runtime, dispatch, and error handling through the crate-private command::execute function. Document one workload per host process, startup before threads or secrets, and matching helpers beside the host executable. Keep live controls and decision delivery for a separate change. ## Tests The all-feature Core build, workspace formatting check, and workspace clippy recipe passed. Existing Core test suites passed. A temporary external Rust caller imported run(config), ran a contained workload, and returned its exit code of 7. The full workspace test run did not pass: an unchanged gateway recorder test failed, then passed in its full test group. An unchanged interception suite failed with the host Python TLS version, then passed with installed Homebrew Python. Remaining local validation was stopped after build-cache disk exhaustion. Linux, remaining workspace tests, and later gates are left to GitHub CI at the operator's request.
0ce78ce to
abb8865
Compare
|
Assessment: Request Changes This PR adds a public library target to Review themes
The underlying goal — letting an application invoke the existing |
ferdingler
left a comment
There was a problem hiding this comment.
Is the library meant to be an entry point for a dedicated worker process, or is it a module embedded in an already-running application (aka Box CLI)?
@ferdingler The plan is the latter. On the CLI side, we'll just need to enforce that Box is called before loading secrets / starting background work. Wanted to start with the simple |
|
Assessment: Comment (re-review of The previous blocking concerns are addressed. The library surface is now the two deliberate operations ( Status of earlier findings
Nice turnaround — the repeat-run guard plus the targeted hardening test close the core safety concern cleanly. |
|
Re-reviewed at For tracking, the three non-blocking follow-ups from the last pass are still open:
Assessment unchanged: Comment — the blocking items are resolved; only these minor items remain. |
|
Re-reviewed at (Note: the GitHub "files changed" view still showed the previous 79-line Test refactor — looks good:
Still open (non-blocking, from earlier passes):
Assessment: Comment — no blocking issues; the remaining items are minor doc/test cleanups. |
|
Re-reviewed at No objection to reverting if the harness-based refactor was out of scope for this PR — the restored test is functionally valid and still covers the two things that matter for the library surface: hardening is applied through the public Worth keeping in mind (all non-blocking, carried from earlier passes):
Assessment: Comment — no blocking issues. |
fab6c86
into
strands-agents:main
Description
Box applications cannot call the existing Box operations through a Rust library. They must start the command as a child process. This prevents Boxy and similar Rust applications from using the same implementation directly.
This PR adds an approved public library surface for two existing operations:
The command parses its own arguments and calls these functions.
cli_mainis not public. Therunfunction accepts the same trailing workload arguments as the command.A process can attempt one Box run. A second call fails, including after the first call fails or finishes. The public run path applies process hardening before it creates the async runtime or reads the configuration.
The host application must call Box before it starts threads or loads secrets. The library cannot determine whether the host already completed either action. This PR does not add process restart or reload behavior.
Related Issues
None.
Type of Change
New feature
Testing
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsI ran the Box build, the workspace all-features tests, the Box clippy command, formatting checks, the no-default-features build,
scripts/test-all.sh, and the deterministic containment suite. The deterministic suite passed 121 checks with 8 expected macOS skips and full coverage. The Box crate had zero owned clippy warnings.The library test proves that the public path disables core dumps, disables Linux dumpability, and refuses a second run. Mutation checks failed when hardening or the repeat-run guard was removed. Linux CI must compile and run the Linux-only assertions because this macOS host does not have the required Linux C cross-compiler.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.