The Forge project has 8 Rust crates with major updates available, an ESLint ecosystem upgrade pending on the frontend, and is running Rust nightly unnecessarily. This plan organizes upgrades into 6 parallelizable phases by risk level and dependency relationships, designed for execution via subagent-driven development.
Phase 1: Rust Stable Switch (no code changes)
Risk: None | Files: 1 new file
Create rust-toolchain.toml in project root:
toml
[toolchain]
channel = "stable"
No code changes — no #![feature(...)] attributes exist anywhere in the codebase.
All of these are independent and can run in parallel.
2A: thiserror 1 → 2
Risk: Low | File: Cargo.toml
Change thiserror = "1" → thiserror = "2"
No code changes needed — src/errors.rs uses only named field interpolation ({path}, {source}), #[from], and #[source]. No positional args or raw identifiers.
Verify:cargo build && cargo test
2B: dirs 5 → 6
Risk: Low | Files: Cargo.toml
Change dirs = "5" → dirs = "6"
Only usage is dirs::home_dir() in src/patterns/learning.rs:353 — this function is unchanged in v6.
Note: config_dir() changed on macOS in v6, but we don't use it.
Risk: Medium | Files: Cargo.toml, possibly config files
Change toml = "0.8" → toml = "1"
Usage sites to check:
src/forge_config.rs:635 — toml::from_str() into serde structs (should be fine)
src/forge_config.rs:651 — toml::to_string_pretty() (should be fine)
src/forge_config.rs:1667 — toml::Value with .get() and from_str() — check this: in v1.0, FromStr for Value parses TOML values, not documents. If this line parses a full TOML document string into Value, use toml::from_str::<toml::Table>() instead.
src/hooks/config.rs:272 — toml::from_str() into serde struct (should be fine)
src/factory/sandbox.rs:68 — toml::from_str() into serde struct (should be fine)
Verify:cargo build && cargo test — specifically test config parsing paths
3B: rusqlite 0.32 → 0.38
Risk: Medium (version gap) | Files: Cargo.toml, possibly src/factory/db.rs
Change rusqlite = { version = "0.32", features = ["bundled"] } → rusqlite = { version = "0.38", features = ["bundled"] }
Usage in src/factory/db.rs: Connection::open(), execute_batch(), execute(), prepare(), query_map(), params![], row.get(), last_insert_rowid() — all core APIs.
No custom ToSql/FromSql implementations. Only uses i64 (not u64/usize).
No statement caching usage. No transaction usage.
Should compile cleanly but has 6 intermediate versions — fix any compilation errors.
Verify:cargo build && cargo test — specifically test database operations
3C: bollard 0.18 → 0.20
Risk: Medium (version gap) | Files: Cargo.toml, possibly src/factory/sandbox.rs
Risk: Medium | Files: ui/package.json, ui/eslint.config.js
The project already uses flat config (ui/eslint.config.js with defineConfig() and globalIgnores()), which is the v10 requirement. This simplifies the upgrade significantly.
Upgrade these packages together in ui/package.json:
eslint-plugin-react-refresh v0.5 changes its export format — update import if needed (uses reactRefresh named export instead of default)
globals v17 removes some globals — verify globals.browser still works
@eslint/js v10 API should be compatible with current js.configs.recommended usage
Verify typescript-eslint ^8.48.0 works with ESLint v10 (v8.56+ adds ESLint v10 support, and ^8.48 should auto-resolve to 8.56+)
Run: cd ui && npm install && npm run lint && npm run build && npm test
Phase 6: Optional — Node.js LTS Consideration
No code changes. Decision point for the team:
Current: Node.js 25.6.1 (Current, EOL Apr 2026)
Recommended: Node.js 24.14.0 LTS (supported through Apr 2028)
If switching, add .node-version file with 24 and test cd ui && npm install && npm run build
Execution Strategy
Use subagent-driven development with parallel agents per phase:
Phase
Agents
Can Parallelize With
1
1 agent
Nothing (do first)
2
4 agents (2A, 2B, 2C, 2D)
All parallel within phase
3
3 agents (3A, 3B, 3C)
All parallel within phase
4
1 agent
Phase 5
5
1 agent
Phase 4
6
Manual decision
After all phases
Phases 2-3 must come after Phase 1 (need stable Rust).
Phases 4-5 can run in parallel (backend vs frontend).
Verification
After all phases complete:
cargo build --release — full backend build
cargo test — all backend tests (unit + integration)
cd ui && npm run lint — frontend linting
cd ui && npm run build — frontend build
cd ui && npm test — frontend tests
Manual: start forge factory and verify WebSocket connectivity in browser
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/jdsingh/.claude/projects/-Users-jdsingh-Projects-AI-forge/9f3c361c-5e7f-47c0-9cd9-c948243582e5.jsonl
If this plan can be broken down into multiple independent tasks, consider using the TeamCreate tool to create a team and parallelize the work.
Assistant
I'll implement this dependency upgrade plan. Let me start with Phase 1 (required before everything else), then parallelize the remaining phases.
Phase 1: Rust Stable Switch
Assistant
Now let me verify the stable toolchain works.
Assistant
There's a pre-existing TypeScript error in the UI tests. Let me fix that first, then proceed with the upgrades.
Assistant
The test uses Partial<ProjectSidebarProps> for overrides but constructs the full props without onDeleteProject. Since onDeleteProject is required in the interface, the test fails to compile. The test needs to provide a default for onDeleteProject.
Assistant
Now let me verify the build works with the stable toolchain.
Assistant
Build succeeds with stable Rust. Now let me run the tests.
Assistant
Phase 1 complete. Now let me read the Cargo.toml to understand current dependencies, then launch parallel agents for Phases 2-5.
Assistant
Good, I have the full picture. Now let me use the Skill tool for subagent-driven development as indicated in the plan.
User
Execution Strategy
Use subagent-driven development with parallel agents per phase:
Phase
Agents
Can Parallelize With
1
1 agent
Nothing (do first)
2
4 agents (2A, 2B, 2C, 2D)
All parallel within phase
3
3 agents (3A, 3B, 3C)
All parallel within phase
4
1 agent
Phase 5
5
1 agent
Phase 4
6
Manual decision
After all phases
Phases 2-3 must come after Phase 1 (need stable Rust).
Phases 4-5 can run in parallel (backend vs frontend).
Verification
After all phases complete:
cargo build --release — full backend build
cargo test — all backend tests (unit + integration)
cd ui && npm run lint — frontend linting
cd ui && npm run build — frontend build
cd ui && npm test — frontend tests
Manual: start forge factory and verify WebSocket connectivity in browser
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/jdsingh/.claude/projects/-Users-jdsingh-Projects-AI-forge/9f3c361c-5e7f-47c0-9cd9-c948243582e5.jsonl
If this plan can be broken down into multiple independent tasks, consider using the TeamCreate tool to create a team and parallelize the work.
User
Phase 6: Optional — Node.js LTS Consideration
No code changes. Decision point for the team:
Current: Node.js 25.6.1 (Current, EOL Apr 2026)
Recommended: Node.js 24.14.0 LTS (supported through Apr 2028)
If switching, add .node-version file with 24 and test cd ui && npm install && npm run build
Risk: Medium | Files: ui/package.json, ui/eslint.config.js
The project already uses flat config (ui/eslint.config.js with defineConfig() and globalIgnores()), which is the v10 requirement. This simplifies the upgrade significantly.
Upgrade these packages together in ui/package.json:
Risk: Medium | Files: Cargo.toml, possibly config files
Change toml = "0.8" → toml = "1"
Usage sites to check:
src/forge_config.rs:635 — toml::from_str() into serde structs (should be fine)
src/forge_config.rs:651 — toml::to_string_pretty() (should be fine)
src/forge_config.rs:1667 — toml::Value with .get() and from_str() — check this: in v1.0, FromStr for Value parses TOML values, not documents. If this line parses a full TOML document string into Value, use toml::from_str::<toml::Table>() instead.
src/hooks/config.rs:272 — toml::from_str() into serde struct (should be fine)
src/factory/sandbox.rs:68 — toml::from_str() into serde struct (should be fine)
Verify:cargo build && cargo test — specifically test config parsing paths
3B: rusqlite 0.32 → 0.38
Risk: Medium (version gap) | Files: Cargo.toml, possibly src/factory/db.rs
Change rusqlite = { version = "0.32", features = ["bundled"] } → rusqlite = { version = "0.38", features = ["bundled"] }
Usage in src/factory/db.rs: Connection::open(), execute_batch(), execute(), prepare(), query_map(), params![], row.get(), last_insert_rowid() — all core APIs.
No custom ToSql/FromSql implementations. Only uses i64 (not u64/usize).
No statement caching usage. No transaction usage.
Should compile cleanly but has 6 intermediate versions — fix any compilation errors.
Verify:cargo build && cargo test — specifically test database operations
3C: bollard 0.18 → 0.20
Risk: Medium (version gap) | Files: Cargo.toml, possibly src/factory/sandbox.rs
All of these are independent and can run in parallel.
2A: thiserror 1 → 2
Risk: Low | File: Cargo.toml
Change thiserror = "1" → thiserror = "2"
No code changes needed — src/errors.rs uses only named field interpolation ({path}, {source}), #[from], and #[source]. No positional args or raw identifiers.
Verify:cargo build && cargo test
2B: dirs 5 → 6
Risk: Low | Files: Cargo.toml
Change dirs = "5" → dirs = "6"
Only usage is dirs::home_dir() in src/patterns/learning.rs:353 — this function is unchanged in v6.
Note: config_dir() changed on macOS in v6, but we don't use it.
Change reqwest = { version = "0.12", features = ["json"] } → reqwest = { version = "0.13", features = ["json"] }
Usage in src/factory/github.rs: Client::new(), .post(), .form(), .header(), .send(), .json() — all stable APIs.
Main change: default TLS backend switched to rustls. If native-tls is needed, add features = ["native-tls"].
Verify:cargo build && cargo test
Assistant
Using Subagent-Driven Development to execute this plan. Phase 1 is already complete (rust-toolchain.toml created, build + tests pass with stable Rust).
Since all Rust crate upgrades share Cargo.toml, they can't be parallelized — I'll work through them sequentially. Phase 4 (axum) and Phase 5 (ESLint) are independent and can run in parallel via subagents.
Let me create the task list and start executing.
Assistant
Now let me start executing. I'll do the simple Cargo.toml version bumps directly (Phase 2A-2D), since they're just version string changes that don't warrant subagent overhead.
Task 1: Phase 2A — thiserror 1 → 2
Assistant
Task 2: Phase 2B — dirs 5 → 6
Assistant
Task 3: Phase 2C — console-rs trio
Assistant
The sandbox restriction on the cargo registry cache was the issue. Build succeeds. Let me run tests.
Assistant
Task 4: Phase 2D — reqwest 0.12 → 0.13
Assistant
Reqwest 0.13 has some API changes. Let me see the full errors.
Assistant
Reqwest 0.13 moved form and query behind feature flags. Let me check the docs and fix.
Assistant
Need to add form and query features. In reqwest 0.13, these were split out.
Assistant
Phase 2 complete. Now moving to Phase 3 — medium-risk upgrades. These may need code changes, so I'll check more carefully.
Task 5: Phase 3A — toml 0.8 → 1.0
Assistant
Let me check the potentially problematic usage first.
Assistant
The usage at line 1667 is toml::from_str(toml_str) which parses a full TOML document string into toml::Value. In toml 1.0, toml::from_str for deserializing documents should still work the same way (it's the FromStr trait impl that changed, not the from_str function). This should be fine.
Assistant
One test failed. Let me check if it's related to the toml upgrade.
Assistant
Passes in isolation — a flaky test, not related to the toml upgrade.
Assistant
Task 6: Phase 3B — rusqlite 0.32 → 0.38
Assistant
Build passes. Let me run tests, especially the DB ones.
Assistant
Task 7: Phase 3C — bollard 0.18 → 0.20
Assistant
Bollard 0.20 has some API changes. Let me see all the errors.
Assistant
Bollard 0.20 moved types to bollard_stubs. Let me get the exact suggestions.
Assistant
Now I have all the info. Let me also check the ListContainersOptions usage and the type annotation issue.
Assistant
Now let me fix all the imports and the type annotation issue.
Assistant
Now fix the ListContainersOptions import and the type annotation.
Assistant
Now fix the type annotation issue at line 306.
Assistant
More changes needed. Let me see all errors.
Assistant
Bollard 0.20 has significant API changes — Config fields are now in ContainerConfig, and options structs lost generic parameters. This needs more thorough work. Let me read the full sandbox file and fix everything.
Assistant
Let me check what the Config struct actually looks like in bollard 0.20.
Assistant
Let me look at the bollard-stubs models to understand the Config struct fields.
Assistant
That's the Swarm Config, not container config. Let me find the container creation config.
Assistant
Now I see — the fields exist (image, cmd, env, working_dir) but the struct is ContainerConfig, not Config. And I also need to check if there's a host_config and labels field.
Assistant
ContainerConfig doesn't have host_config. Let me check how create_container expects its input in bollard 0.20.
Assistant
So create_container now takes ContainerCreateBody, not Config. Let me find that type.
Assistant
ContainerCreateBody has all the fields we need (image, cmd, env, working_dir, labels, host_config). Now let me also check the other changed option structs.
Assistant
So bollard 0.20 uses builders now. Let me check the query_parameters module.
Assistant
Now I have the full picture. Let me check what fields CreateContainerOptions has:
Assistant
Now I have everything I need. Let me also check StopContainerOptions, LogsOptions, ListContainersOptions, and WaitContainerOptions.
Assistant
Now I also need to check how start_container and wait_container take options in 0.20.
Assistant
Now I have all the information. Let me also check CreateImageOptions:
Assistant
Now I have the complete picture. Key changes needed:
Options structs no longer have generic type parameters
CreateContainerOptions fields changed (name is now Option<String>, platform is String)
StopContainerOptions has t as Option<i32> instead of i32
LogsOptions no longer has generic type param
ListContainersOptionsfilters is now Option<HashMap<...>>
CreateImageOptionsfrom_image is now Option<String>
Assistant
Now update the container_config from Config to ContainerCreateBody:
Assistant
Now update start_container — no more generic type param:
Assistant
Now update LogsOptions — no more generic type param:
Assistant
Now update StopContainerOptions — t is now Option<i32>:
Assistant
Now update WaitContainerOptions — no more generic type param:
Assistant
Now update CreateImageOptions — from_image is now Option<String>:
Assistant
Now update ListContainersOptions — filters is now Option<HashMap<...>>:
Assistant
All 1229 tests pass.
Assistant
Phases 1-3 complete. Now for Phase 4 (axum 0.7→0.8) and Phase 5 (ESLint v10), these are independent (backend vs frontend), so I'll run them in parallel using subagents.
Assistant
Two subagents are now working in parallel:
Axum 0.7 → 0.8 upgrade (backend, Rust)
ESLint v10 ecosystem upgrade (frontend, React/TS)
I'll wait for both to complete before running final verification.
ui/eslint.config.js — Added .vite to ignores, configured new react-hooks rules
ui/src/ — Replaced any with Record<string, unknown>, refactored WebSocket provider
Final verification
cargo build --release — pass
cargo test — 1229 Rust tests pass (+ 35 doctests)
npm run lint — 0 errors, 4 warnings
npm run build — pass
npm test — 171 frontend tests pass
User
Summary of Changes
Package version upgrades in /Users/jdsingh/Projects/AI/forge/ui/package.json
Package
Previous
Updated
eslint
^9.39.1
^10.0.2
@eslint/js
^9.39.1
^10.0.1
eslint-plugin-react-refresh
^0.4.24
^0.5.2
globals
^16.5.0
^17.3.0
Additionally, @testing-library/dom@^10.4.1 was added as an explicit devDependency because --legacy-peer-deps (needed due to eslint-plugin-react-hooks@7.0.1 not yet declaring ESLint 10 in its peer dependency range) prevented automatic peer dependency resolution.
ESLint config changes in /Users/jdsingh/Projects/AI/forge/ui/eslint.config.js
Added .vite to globalIgnores -- Vite's cached dependency bundles in .vite/deps/ contain inline eslint-disable comments referencing rules not registered for .js files, causing "Definition for rule not found" errors.
Added rule overrides:
@typescript-eslint/no-unused-vars -- configured to allow underscore-prefixed variables (argsIgnorePattern: '^_', varsIgnorePattern: '^_'), a standard convention for intentionally unused variables
react-hooks/set-state-in-effect: 'off' -- new rule in eslint-plugin-react-hooks v7 that flags setState calls inside effects. Disabled because it produces false positives for valid patterns like interval callbacks and state resets on dependency changes
react-refresh/only-export-components -- downgraded from error to warn with allowConstantExport: true, since several files legitimately export hooks alongside components (e.g., context files that export both a Provider component and custom hooks)
Source code fixes
/Users/jdsingh/Projects/AI/forge/ui/src/types/index.ts -- Replaced 3 instances of with :
User
lets commit all the changes to a branch
Assistant
Let me check the current state of changes first.
Assistant
Committed to branch chore/dependency-upgrades at 8099da5. 15 files changed, 584 insertions, 752 deletions.
Silent failure hunter — error handling in sandbox.rs and WebSocketContext
Test analyzer — test coverage adequacy for the changes
Waiting for results...
Assistant
Code review complete — no critical issues. One action item: update CLAUDE.md tech stack versions. Waiting for the other two agents...
User
Summary
The code changes are well-executed and mechanically correct for each library migration:
Rust changes are clean:
The axum 0.8 route syntax migration from :param to {param} and *path to {*path} is complete and consistent across all routes in api.rs.
The Message::Ping(vec![].into()) and Message::Text(msg.into()) changes in ws.rs correctly adapt to axum 0.8's switch from Vec<u8> / String to Bytes / Utf8Bytes for WebSocket message payloads.
The bollard 0.20 migration in sandbox.rs correctly moves from bollard::container::* to bollard::query_parameters::* and from Config to ContainerCreateBody, with appropriate adjustments to struct fields (name becoming Option<String>, filters becoming Option<HashMap<...>>, etc.).
The thiserror v1 to v2 upgrade is seamless -- the derive macro API is backward-compatible and errors.rs needs no changes.
The reqwest 0.13 upgrade correctly adds the now-required form and query feature flags.
UI changes are clean:
The WebSocketContext refactor inlines connect into the useEffect body, eliminating the useCallback + refs pattern that eslint-plugin-react-hooks v7 now flags with its new set-state-in-effect rule (which is explicitly turned off in the ESLint config since the pattern is intentional).
The any to Record<string, unknown> replacements in types, handlers, and hooks are correct and improve type safety.
The test updates (IDLE status assertion, onDeleteProject prop) match the current component interface.
One action item: Update the CLAUDE.md Tech Stack line to reflect the new dependency versions, particularly axum v0.8, thiserror v2, and git2 v0.20.
<total_tokens>113967</total_tokens><tool_uses>28</tool_uses><duration_ms>180165</duration_ms>
Full transcript available at: /private/tmp/claude-501/-Users-jdsingh-Projects-AI-forge/tasks/a9b036569507d87ae.output
User
2. reqwest features changed without clear rationale documentation (Confidence: 80)
File: /Users/jdsingh/Projects/AI/forge/Cargo.toml, line 23
The reqwest dependency changed from:
toml
reqwest = { version = "0.12", features = ["json"] }
to:
toml
reqwest = { version = "0.13", features = ["json", "form", "query"] }
The form and query features are indeed used in /Users/jdsingh/Projects/AI/forge/src/factory/github.rs (lines 115, 143, 179, 213), so adding them is correct. However, this raises the question: how was the code compiling before without these features? In reqwest 0.12, form and query were available without feature flags (they were part of the default feature set). In reqwest 0.13, they were split into separate features. This is a correctness fix that should be explicitly called out -- without these features in 0.13, the GitHub OAuth flow would fail to compile.
This is not a bug in the PR -- it is actually a necessary fix. Just noting it is correctly addressed.
User
Critical Issues (90-100)
None found.
Important Issues (80-89)
1. CLAUDE.md Tech Stack section is now outdated (Confidence: 85)
File: /Users/jdsingh/Projects/AI/forge/CLAUDE.md, line 15
This PR upgrades axum from 0.7 to 0.8, thiserror from 1 to 2, git2 from 0.19 to 0.20, rusqlite from 0.32 to 0.38, bollard from 0.18 to 0.20, and several others. The documented versions are now wrong, which violates the principle that CLAUDE.md should accurately reflect the project's state. Future contributors (including AI agents) relying on these docs will reference the wrong API versions.
Suggested fix: Update line 15 of CLAUDE.md to reflect the new versions:
/Users/jdsingh/Projects/AI/forge/ui/src/test/handlers.ts -- as any replaced with proper types
/Users/jdsingh/Projects/AI/forge/ui/src/types/index.ts -- any replaced with Record<string, unknown>
Assistant
Test analysis complete. Waiting for the last agent...
User
Verdict
The test changes are adequate for the Rust backend changes, where the existing comprehensive API test suite and the compiler's type system provide strong coverage for the mechanical migration. The primary gap is the frontend WebSocket refactor at /Users/jdsingh/Projects/AI/forge/ui/src/contexts/WebSocketContext.tsx, which received a meaningful structural change (moving from refs to effect-local state with a cancellation flag) but has only trivial test coverage. Adding tests for the cleanup/cancellation behavior and the URL-change tear-down/reconnect cycle would meaningfully reduce regression risk for the real-time communication layer.
<total_tokens>84008</total_tokens><tool_uses>21</tool_uses><duration_ms>195264</duration_ms>
Full transcript available at: /private/tmp/claude-501/-Users-jdsingh-Projects-AI-forge/tasks/a14cdf0ae1ba96d52.output
User
5. Positive Observations
The Rust api.rs test suite is excellent and implicitly validates the route migration. The 17 existing tests at /Users/jdsingh/Projects/AI/forge/src/factory/api.rs (lines 1183-1924) exercise all API routes using app.oneshot() with URIs like /api/projects/1, /api/issues/1/run, /api/runs/1/cancel, etc. Since axum 0.8's {id} syntax is a compile-time and route-matching change, and these tests use actual URI paths (not route patterns), they validate that the parameter extraction works correctly with the new syntax. This is strong implicit coverage.
The ProjectSidebar.test.tsx fix is correct and necessary. Adding onDeleteProject: vi.fn() at /Users/jdsingh/Projects/AI/forge/ui/src/test/ProjectSidebar.test.tsx line 16 fixes a missing required prop that would cause TypeScript compilation errors. This is a proper maintenance fix.
The handlers.ts type improvements are good practice. Replacing as any with as Record<string, unknown> at /Users/jdsingh/Projects/AI/forge/ui/src/test/handlers.ts lines 15 and 22 improves type safety without changing behavior.
The App.test.tsx assertion update reflects real UI behavior. Changing from "No active agent runs" to "IDLE" at /Users/jdsingh/Projects/AI/forge/ui/src/test/App.test.tsx line 164 correctly tracks the UI's current empty-state rendering.
The ws.rs serialization tests are thorough. The 20+ tests covering every WsMessage variant with both serialization and roundtrip deserialization provide excellent regression protection for the data contract between backend and frontend.
The sandbox.rs unit tests for SandboxConfig and parse_memory_limit are well-structured and exercise defaults, partial config, full config, invalid input, and edge cases like the empty sandbox section.
User
4. Test Quality Issues
Issue 1: WebSocketProvider.test.tsx tests are effectively no-ops
This test asserts expect(true).toBe(true) -- it will always pass regardless of whether the subscription logic works. It should at minimum verify that callback was not called (since no message was sent), or better yet, use a mock WebSocket to send a message and verify the callback is called.
Issue 2: App test mocks the entire WebSocket context
This is a reasonable approach for App-level integration tests (you don't want real WebSocket connections), but it means the refactored WebSocket provider is completely bypassed in the App tests. This is not a flaw in the test approach, but it means the App tests provide zero coverage for the WebSocket refactor.
User
3. Important Improvements
Improvement 1: Rust sandbox.rs bollard migration has no behavioral test for the new API types (Criticality: 5/10)
The existing unit tests in sandbox.rs (lines 367-504) test SandboxConfig parsing and parse_memory_limit, which is good. However, none of the Docker interaction methods (run_pipeline, stop, wait, ensure_image, prune_stale_containers) have unit tests -- they require a running Docker daemon. This is acceptable since these are integration-level concerns, and the code compiles against the new bollard API, which provides static type-checking for the struct field changes. The compiler already catches most migration errors here.
Why it matters: Static typing covers the struct changes, but runtime behavior differences in bollard 0.20 (if any) would only be caught by integration tests or manual testing. The risk is low because the changes are mechanical (wrapping values in Some(), using Default::default()).
Improvement 2: The ws.rsMessage::Text(msg.into()) and Message::Ping(vec![].into()) changes lack a targeted test (Criticality: 4/10)
File: /Users/jdsingh/Projects/AI/forge/src/factory/ws.rs, lines 257 and 267
The axum 0.8 WebSocket API changed Message::Text(String) to require Message::Text(Utf8Bytes) and Message::Ping(Vec<u8>) to Message::Ping(Bytes), hence the .into() calls. The existing tests in ws.rs thoroughly test serialization/deserialization of WsMessage variants and the broadcast_message function, but the actual run_socket_loop function (which contains the .into() calls) has no unit test. This is acceptable because:
The .into() conversions are compiler-verified (Rust's type system ensures the Into impl exists).
Testing run_socket_loop would require mocking the WebSocket split streams, which is complex for minimal benefit.
User
2. Critical Gaps
Gap 1: WebSocketContext cleanup/cancellation logic is untested (Criticality: 8/10)
The WebSocket provider was fully refactored from a useCallback+useRef pattern to an inline-useEffect pattern with a cancelled flag to prevent reconnection after unmount. This is a meaningful behavioral change:
tsx
// New pattern (lines 19-80):
useEffect(() => {
let cancelled = false
function connect() {
if (cancelled) return
// ...
ws.onclose = () => {
// ...
reconnectTimeout = window.setTimeout(connect, delay)
}
}
connect()
return () => {
cancelled = true
if (reconnectTimeout) clearTimeout(reconnectTimeout)
ws?.close()
}
}, [url])
The existing test at /Users/jdsingh/Projects/AI/forge/ui/src/test/WebSocketProvider.test.tsx only verifies that useWsStatus returns a valid status string and that useWsSubscribe can be unmounted without throwing. It does not test:
That the cleanup function prevents reconnection after unmount (the cancelled flag behavior)
That pending reconnect timeouts are cleared on unmount
That changing the url prop tears down the old connection and establishes a new one (the [url] dependency)
That exponential backoff is capped at 30 seconds
That the cancelled flag prevents stale reconnects when the URL changes rapidly
Why it matters: If the cancelled flag logic has a bug, the component would attempt to reconnect and call setStatus after unmount, causing React memory leak warnings and potentially corrupting application state. If the cleanup doesn't properly clear timeouts, old reconnect timers would fire after the component is gone.
Gap 2: No test verifies message dispatch to subscribers in the refactored provider (Criticality: 7/10)
The onmessage handler was moved into the useEffect closure. One subtle change is the error logging line went from (message as any)?.type to message.type (line 47). While this is a minor improvement, the core subscriber dispatch logic has no direct test. The current test (useWsSubscribe calls back on messages) at line 18-25 of the test file only tests that subscribe/unmount doesn't throw -- it never actually sends a message through the WebSocket to verify the callback is invoked.
Why it matters: If the subscriber dispatch breaks, no WebSocket messages would be delivered to any component in the UI -- all real-time updates (pipeline progress, issue moves, agent events) would silently stop working.
User
Test Coverage Analysis for PR #14 (chore/dependency-upgrades)
1. Summary
This PR upgrades numerous Rust and JavaScript dependencies (axum 0.7->0.8, bollard 0.18->0.20, thiserror 1->2, rusqlite 0.32->0.38, eslint 9->10, and many others) and includes corresponding code migrations to adapt to API changes. The test modifications are minimal and largely mechanical: updating assertions to match current UI behavior, adding a required prop to a test helper, and replacing as any with proper types. The Rust backend tests are the strong point -- the existing api.rs test suite exercises all route endpoints through oneshot requests, which implicitly validates the /:id to /{id} route parameter migration. The frontend WebSocket refactor is the primary coverage concern.
Assistant
All three review agents are complete. Here's the aggregated summary:
PR Review Summary
Critical Issues (1 found)
[silent-failure-hunter]sandbox.rs:225-241 — Container log stream errors silently dropped via while let Some(Ok(output)) in spawned task. If Docker returns an error mid-stream, logs stop with no explanation.
Important Issues (3 found)
[silent-failure-hunter]WebSocketContext.tsx:38-42 — Malformed WebSocket messages silently discarded with bare catch { return }. No logging means server serialization bugs would be invisible.
[silent-failure-hunter]sandbox.rs:247-266 — stop() discards both stop and remove errors via let _ =. Return type Result<()> is misleading since it always returns Ok.
[silent-failure-hunter]WebSocketContext.tsx:52-58 — Unlimited reconnection with no max attempt feedback.
[test-analyzer]WebSocketContext.tsx — Refactored cleanup/cancellation logic has no test coverage; existing WebSocket tests are effectively no-ops.
Strengths
Rust API test suite implicitly validates all 12 route parameter migrations
Bollard migration is mechanically correct with proper ContainerCreateBody, option struct updates
create_container, start_container, wait() all use proper .context() error propagation
Type safety improved across frontend (any → Record<string, unknown>)
All 1229 Rust tests and 171 frontend tests pass
Recommended Action
The critical/important issues are all pre-existing — they were carried forward during the migration, not introduced by this PR. Given this is a dependency upgrade PR, I'd recommend:
Fix the CLAUDE.md version line (quick, directly relevant to this PR)
File the silent failure issues as follow-up work — they're real problems but predate this PR
Want me to fix the CLAUDE.md version line now and leave the silent failure items for a separate PR?
User
Summary Table
#
Location
Severity
Issue
1
WebSocketContext.tsx:38-42
HIGH
Silent discard of unparseable WebSocket messages
2
sandbox.rs:225-241
CRITICAL
Log stream errors silently dropped in spawned task
3
sandbox.rs:247-266
HIGH
stop() discards both stop and remove errors; Result return type is misleading
4
sandbox.rs:105-115
MEDIUM
new() returns None with no logging of why Docker is unavailable
5
WebSocketContext.tsx:94-100
MEDIUM
useWsSubscribe silently no-ops outside provider
6
WebSocketContext.tsx:52-58,64-69
MEDIUM
Unlimited reconnection with no max attempt feedback
7
ws.rs:257-258,267-268
LOW
Send error details discarded (acceptable pattern)
8
ws.rs:304-312
LOW
Broadcast send error discarded (justified by comment)
Issues 1-4 should be addressed before merging. Issue 2 in particular is the most dangerous: a bollard 0.20 behavioral change in how log stream errors are surfaced would be completely invisible to both users and developers. Issues 5-6 are improvements worth making in a follow-up. Issues 7-8 are acceptable as-is.
<total_tokens>63971</total_tokens><tool_uses>15</tool_uses><duration_ms>214047</duration_ms>
Full transcript available at: /private/tmp/claude-501/-Users-jdsingh-Projects-AI-forge/tasks/a810d3e9589990b24.output
User
Items Done Well
To be fair, this PR does several things correctly from an error handling perspective:
create_container and start_container both use .context("...") to add descriptive error messages and propagate via ?. This is the correct pattern.
wait() method properly handles the stream ending unexpectedly with anyhow::bail!("Container wait stream ended unexpectedly") -- this is good, explicit error handling.
prune_stale_containers logs individual container prune failures via eprintln! and continues processing, which is appropriate for a cleanup operation.
WebSocket subscriber error handling wraps each subscriber callback in try-catch with console.error including the message type and the error -- this is well done.
The onerror handler on the WebSocket properly logs and then closes the connection, which will trigger the onclose handler for reconnection.
Type safety improvements changing any to Record<string, unknown> in ui/src/types/index.ts, ui/src/hooks/useAgentTeam.ts, and ui/src/test/handlers.ts are positive changes that make TypeScript catch more type errors at compile time.
User
ISSUE 8: broadcast_message uses eprintln! instead of structured logging
Severity: LOW (not changed by this PR, but worth noting)
Code:
rust
pub fn broadcast_message(tx: &broadcast::Sender<String>, msg: &WsMessage) {
match serde_json::to_string(msg) {
Ok(json) => {
let _ = tx.send(json); // Ignore error if no receivers
}
Err(e) => {
eprintln!("[ws] Failed to serialize WsMessage: {}", e);
}
}
}
Issue Description: Not changed by this PR, but the let _ = tx.send(json) silently discards broadcast send errors. The comment says "Ignore error if no receivers" which is a reasonable justification for the send call (broadcast channels error when there are zero receivers, which is expected). The serialization failure logging via eprintln! is acceptable for a Rust CLI application but would benefit from structured logging if one is adopted.
User
ISSUE 7: ws.rs sends Ping/Text with .into() -- error handling on send is adequate but borderline
Location:/Users/jdsingh/Projects/AI/forge/src/factory/ws.rs, lines 257-258 and 267-268
Severity: LOW (acceptable pattern)
Code:
rust
if sender.send(Message::Ping(vec![].into())).await.is_err() {
break;
}
// ...
if sender.send(Message::Text(msg.into())).await.is_err() {
break;
}
Issue Description: The PR changes Message::Ping(vec![]) to Message::Ping(vec![].into()) and Message::Text(msg) to Message::Text(msg.into()) for the axum 0.8 WebSocket API migration. The error handling pattern (.is_err() then break) is adequate for WebSocket send failures -- when a send fails, the connection is dead and breaking out of the loop is the correct action. However, the error itself is discarded without logging.
This is a borderline case. For ping failures, logging is arguably noise. For text message failures, a log could help debug why a client stopped receiving updates. The existing pattern at line 297 (let _ = sender.send(Message::Close(None)).await;) is fine since it is a best-effort close.
Recommendation: Consider logging text message send failures at debug level. The ping failure is acceptable without logging.
User
ISSUE 6: WebSocket reconnection has no maximum attempt limit
Location:/Users/jdsingh/Projects/AI/forge/ui/src/contexts/WebSocketContext.tsx, lines 52-58 and 64-69
Issue Description: The reconnection logic has exponential backoff capped at 30 seconds but no maximum number of attempts. If the server is down permanently, this will retry every 30 seconds forever. While the cancelled flag handles cleanup on unmount, a long-running tab will silently produce reconnection attempts indefinitely. The only user feedback is the status being 'disconnected' -- there is no distinction between "temporarily disconnected, retrying" and "server unreachable after 100 attempts."
The refactoring in this PR moved from useCallback + refs to local variables in useEffect, which is actually a good cleanup. However, the lack of a maximum attempt threshold was carried forward.
User Impact: Users see the "disconnected" status indicator but have no way to know if reconnection will succeed. After many failed attempts, a message like "Server appears unreachable -- please check your connection" would be far more helpful than silently continuing to retry.
Recommendation: Add a maximum retry threshold, and when exceeded, provide distinct user feedback.
User
ISSUE 5: useWsSubscribe silently does nothing when used outside provider
Issue Description: If useWsSubscribe is called outside of a WebSocketProvider, ctx will be null and the hook silently does nothing. No warning, no error. The subscriber callback will never be invoked, and the component using this hook will appear to work but never receive any real-time updates.
Similarly, useWsStatus() at line 102-104 silently returns 'disconnected' when used outside the provider, which could mask a missing provider bug.
Hidden Errors:
Component tree missing WebSocketProvider wrapper
Provider accidentally removed during refactoring
Component moved to a different part of the tree that lacks the provider
User Impact: A component that depends on real-time WebSocket updates would silently show stale data. The developer would see no console errors and would have to trace through the component tree to discover the missing provider. This is a common React context pitfall.
Recommendation: Throw an error (or at least log a warning) when the hook is used outside its provider. This is a standard React pattern.
tsx
export function useWsSubscribe(callback: Subscriber) {
const ctx = useContext(WsContext)
if (!ctx) {
console.error('[ws] useWsSubscribe called outside of WebSocketProvider. WebSocket messages will not be received.')
}
useEffect(() => {
if (!ctx) return
return ctx.subscribe(callback)
}, [ctx, callback])
}
User
ISSUE 4: DockerSandbox::new() silently returns None without logging why
Issue Description: This constructor returns Option<Self>, discarding all error information from both connect_with_socket_defaults() and ping(). The caller has no way to distinguish between "Docker is not installed", "Docker socket permissions are wrong", "Docker daemon is not running", or "Docker daemon rejected the ping". This is pre-existing but directly relevant because the bollard 0.20 upgrade could change connection behavior, error types, or default socket paths.
Hidden Errors:
Socket file does not exist (/var/run/docker.sock missing)
Permission denied on the socket
Docker daemon version incompatibility (bollard 0.20 may require newer Docker API)
TLS/certificate issues
Network errors reaching a remote Docker host
User Impact: When Docker is not available, the pipeline system silently falls back to non-containerized execution (or simply does nothing). The user gets no indication of why Docker is unavailable, making it impossible to fix the configuration. This is especially problematic during a bollard version upgrade where the connection behavior might change.
Recommendation: At minimum, log the specific error before returning None. Better yet, consider returning Result<Option<Self>> to distinguish between "Docker not available" (expected) and "Docker connection error" (unexpected).
rust
pub async fn new(default_image: String) -> Option<Self> {
let docker = match Docker::connect_with_socket_defaults() {
Ok(d) => d,
Err(e) => {
eprintln!("[sandbox] Docker connection failed: {}", e);
return None;
}
};
if let Err(e) = docker.ping().await {
eprintln!("[sandbox] Docker ping failed (daemon may not be running): {}", e);
return None;
}
Some(Self { docker, default_image })
}
User
ISSUE 3: stop() silently discards both stop and remove errors
pub async fn stop(&self, container_id: &str) -> Result<()> {
// Stop with 10s grace period
let stop_opts = StopContainerOptions { t: Some(10), ..Default::default() };
let _ = self
.docker
.stop_container(container_id, Some(stop_opts))
.await;
// Remove the container
let remove_opts = RemoveContainerOptions {
force: true,
..Default::default()
};
let _ = self
.docker
.remove_container(container_id, Some(remove_opts))
.await;
Ok(())
}
Issue Description: Both let _ = assignments explicitly discard errors from stop_container and remove_container. This function's return type is Result<()> but it always returns Ok(()), making the Result return type misleading. The PR changed the StopContainerOptions API from { t: 10 } to { t: Some(10), ..Default::default() }, which is correct for the bollard 0.20 migration, but the fundamental problem of swallowed errors remains.
Hidden Errors:
Container does not exist (already removed by another process)
Permission denied on the Docker socket
Docker daemon unreachable
Container in a state that cannot be stopped (e.g., paused)
User Impact: The prune_stale_containers function on line 338 calls self.stop(id) and catches errors with match self.stop(id).await. But since stop() never returns an Err, the error branch is dead code. Stale containers that fail to be removed are silently skipped, and the counter is incremented even though the container was not actually removed.
Code (after the PR, but this is a pre-existing issue carried through the migration):
rust
tokio::spawn(async move {
let opts = LogsOptions {
follow: true,
stdout: true,
stderr: true,
..Default::default()
};
let mut stream = docker.logs(&cid, Some(opts));
while let Some(Ok(output)) = stream.next().await {
let text = output.to_string();
for line in text.lines() {
if line_tx.send(line.to_string()).await.is_err() {
break;
}
}
}
});
Issue Description: The pattern while let Some(Ok(output)) silently ignores all Err results from the log stream. If Docker returns an error mid-stream (connection reset, daemon crash, container OOM), this loop simply terminates without any logging or notification. The spawned task has no error reporting path at all -- it cannot propagate errors back to the caller, and it does not log them.
The bollard 0.20 migration did not change this pattern, but this is a critical carry-forward: the entire purpose of this function is to stream pipeline container logs to the user. Silent termination means the user sees their pipeline log output simply stop mid-stream with no explanation.
Hidden Errors:
Docker daemon disconnection
Container crash/OOM kill (the stream errors out, the while let Some(Ok(...)) silently exits)
Network interruption to the Docker socket
Permission errors on the Docker API
Any bollard 0.20 behavioral changes in error surfacing that would be invisible
User Impact: Pipeline logs stop appearing in the UI with zero explanation. The user has no way to know whether the pipeline is still running, crashed, or if there is a Docker connectivity issue. This is especially dangerous during a dependency upgrade where stream behavior might change subtly.
Recommendation: Match explicitly on variants and log them. Also consider sending a sentinel message through the channel so the consumer knows the stream terminated abnormally.
Issue Description: When a WebSocket message arrives that is not valid JSON, this catch block silently discards it with a bare return. No logging, no counter, no indication whatsoever. This pattern existed before the PR but was carried forward unchanged during the refactor. The catch block has no parameter binding at all (bare catch {}), which means the error object itself is thrown away.
Hidden Errors:
Malformed JSON from the server (indicates a server-side serialization bug)
Binary WebSocket frames accidentally treated as text
Partial messages from interrupted writes
Server sending plain-text error messages instead of JSON (e.g., "Internal Server Error" from a proxy)
User Impact: If the server starts sending malformed messages due to a bug (e.g., a serialization change during an upgrade like this one), the user sees absolutely nothing. The UI simply stops reacting to updates. The user would have no idea why their pipeline status stopped updating. They would need to manually open browser DevTools and inspect the WebSocket frames to diagnose this. Given that this PR changes the server-side Message::Text(msg.into()) construction, any regression in serialization would be completely invisible on the client.
Recommendation: Log the parse failure at minimum. This is a boundary between the server and client -- malformed data here signals a server bug, not routine noise.
This PR upgrades 11 Rust crates (bollard 0.18 to 0.20, axum 0.7 to 0.8, thiserror 1 to 2, etc.) and the ESLint v10 ecosystem, plus refactors the WebSocket provider. While much of the API migration is mechanically correct, I found several error handling issues -- some pre-existing that this PR carries forward, and some introduced or modified by the changes.
User
Lets implement all the recommendations using subagents
Assistant
I'll split the work into two parallel subagents — one for Rust-side fixes, one for frontend fixes — since they touch separate files.
Frontend fixes — WebSocket JSON parse logging, useWsSubscribe outside-provider warning, max reconnection limit with 'failed' status
Waiting for both to complete...
Assistant
Rust fixes complete — all 1229 tests pass. Waiting for the frontend subagent...
User
Changes Applied
1. /Users/jdsingh/Projects/AI/forge/CLAUDE.md (line 15) -- Updated the tech stack line to reflect current dependency versions:
git2 v0.19 changed to git2 v0.20
axum v0.7 changed to axum v0.8
anyhow + thiserror changed to anyhow + thiserror v2
2. /Users/jdsingh/Projects/AI/forge/src/factory/sandbox.rs -- Log stream error handling (lines ~233-249) -- Replaced while let Some(Ok(output)) which silently dropped stream errors with an explicit match on each result. On Err, the error is logged to stderr and forwarded to the log channel before breaking out of the loop. On receiver disconnect, it now uses return instead of break to exit the spawned task immediately.
3. /Users/jdsingh/Projects/AI/forge/src/factory/sandbox.rs -- stop() method (lines ~250-270) -- Replaced two let _ = ... patterns that silently discarded Docker API errors with if let Err(e) blocks that log warnings to stderr. This covers both stop_container (noting the container may already be stopped) and remove_container.
4. /Users/jdsingh/Projects/AI/forge/src/factory/sandbox.rs -- new() method (lines ~105-115) -- Replaced .ok()? on Docker connection and .is_err() on ping with explicit match/if let Err patterns that log the specific error messages to stderr before returning None. This makes it much easier to diagnose Docker connectivity issues.
Verification
cargo build -- compiled successfully
cargo test --lib -- all 1229 tests passed, 0 failures
<total_tokens>35424</total_tokens><tool_uses>10</tool_uses><duration_ms>79101</duration_ms>
Full transcript available at: /private/tmp/claude-501/-Users-jdsingh-Projects-AI-forge/tasks/ab4322be26ee65a80.output
Assistant
Both subagents complete. Let me run a final full verification and amend the commit.
3. Added logging to the silent JSON parse catch block (lines 42-44)
Previously the catch block in ws.onmessage was completely silent (catch { return }). Now it logs a warning with the error and a truncated preview of the raw data:
AgentEvent.metadata: any | null -> Record<string, unknown> | null
AgentAction metadata in WsMessage union type
VerificationResult details in WsMessage union type
/Users/jdsingh/Projects/AI/forge/ui/src/contexts/WebSocketContext.tsx -- Refactored the WebSocket provider to satisfy new react-hooks v7 rules:
Removed as any cast (replaced with proper type access via message.type)
Eliminated the self-referencing useCallback pattern that triggered react-hooks/immutability (the connect function referenced itself via closure for reconnection). Replaced with a single useEffect containing a plain connect() function that naturally self-references within the effect scope. This is a cleaner pattern that also removes the need for connectRef, wsRef, reconnectTimeoutRef, and reconnectAttemptRef as separate refs.
/Users/jdsingh/Projects/AI/forge/ui/src/hooks/useAgentTeam.ts -- Replaced details: any with details: Record<string, unknown> in the VerificationResult interface.
/Users/jdsingh/Projects/AI/forge/ui/src/test/handlers.ts -- Replaced 2 instances of as any with as Record<string, unknown> in MSW request body parsing.
/Users/jdsingh/Projects/AI/forge/ui/src/test/App.test.tsx -- Fixed a pre-existing test failure where the test expected "No active agent runs" empty state text, but the UI now shows project cards with "IDLE" status when no runs are active. Updated the test to match current UI behavior.
Verification
All three commands pass:
npm run lint -- 0 errors, 4 warnings
npm run build -- TypeScript + Vite build succeeds
npm test -- 14 test files, 171 tests, all passing
<total_tokens>89512</total_tokens><tool_uses>97</tool_uses><duration_ms>882382</duration_ms>
Full transcript available at: /private/tmp/claude-501/-Users-jdsingh-Projects-AI-forge/tasks/af2329321f3970128.output
Aggregate Results
After agents complete, summarize:
Critical Issues (must fix before merge)
Important Issues (should fix)
Suggestions (nice to have)
Positive Observations (what's good)
Provide Action Plan
Organize findings:
markdown
# PR Review Summary
## Critical Issues (X found)
- [agent-name]: Issue description [file:line]
## Important Issues (X found)
- [agent-name]: Issue description [file:line]
## Suggestions (X found)
- [agent-name]: Suggestion [file:line]
## Strengths
- What's well-done in this PR
## Recommended Action
1. Fix critical issues first
2. Address important issues
3. Consider suggestions
4. Re-run review after fixes
Usage Examples:
Full review (default):
code
/pr-review-toolkit:review-pr
Specific aspects:
code
/pr-review-toolkit:review-pr tests errors
# Reviews only test coverage and error handling
/pr-review-toolkit:review-pr comments
# Reviews only code comments
/pr-review-toolkit:review-pr simplify
# Simplifies code after passing review
Parallel review:
code
/pr-review-toolkit:review-pr all parallel
# Launches all agents in parallel
Agent Descriptions:
comment-analyzer:
Verifies comment accuracy vs code
Identifies comment rot
Checks documentation completeness
pr-test-analyzer:
Reviews behavioral test coverage
Identifies critical gaps
Evaluates test quality
silent-failure-hunter:
Finds silent failures
Reviews catch blocks
Checks error logging
type-design-analyzer:
Analyzes type encapsulation
Reviews invariant expression
Rates type design quality
code-reviewer:
Checks CLAUDE.md compliance
Detects bugs and issues
Reviews general code quality
code-simplifier:
Simplifies complex code
Improves clarity and readability
Applies project standards
Preserves functionality
Tips:
Run early: Before creating PR, not after
Focus on changes: Agents analyze git diff by default
Address critical first: Fix high-priority issues before lower priority
Re-run after fixes: Verify issues are resolved
Use specific reviews: Target specific aspects when you know the concern
1. Stage all changes
2. Run: /pr-review-toolkit:review-pr all
3. Address all critical and important issues
4. Run specific reviews again to verify
5. Create PR
After PR feedback:
code
1. Make requested changes
2. Run targeted reviews based on feedback
3. Verify issues are resolved
4. Push updates
Notes:
Agents run autonomously and return detailed reports
Each agent focuses on its specialty for deep analysis
Results are actionable with specific file:line references
Agents use appropriate models for their complexity
All agents available in /agents list
pruned
There is a partial justification for tolerating stop errors (e.g., container already stopped), but remove errors are different -- a failed remove means resource leakage. At minimum, the remove failure should be logged, and ideally the function's return type should honestly reflect possible failures.
Recommendation: Log errors rather than silently discarding them. Distinguish between expected failures (already stopped) and unexpected ones.
rust
pub async fn stop(&self, container_id: &str) -> Result<()> {
let stop_opts = StopContainerOptions { t: Some(10), ..Default::default() };
if let Err(e) = self.docker.stop_container(container_id, Some(stop_opts)).await {
// Container may already be stopped; log but don't fail
eprintln!("[sandbox] Warning: stop_container {} failed (may already be stopped): {}", container_id, e);
}
let remove_opts = RemoveContainerOptions {
force: true,
..Default::default()
};
self.docker
.remove_container(container_id, Some(remove_opts))
.await
.with_context(|| format!("Failed to remove container {}", container_id))?;
Ok(())
}
Err
rust
tokio::spawn(async move {
let opts = LogsOptions {
follow: true,
stdout: true,
stderr: true,
..Default::default()
};
let mut stream = docker.logs(&cid, Some(opts));
while let Some(result) = stream.next().await {
match result {
Ok(output) => {
let text = output.to_string();
for line in text.lines() {
if line_tx.send(line.to_string()).await.is_err() {
return; // receiver dropped, nothing to do
}
}
}
Err(e) => {
eprintln!("[sandbox] Log stream error for container {}: {}", cid, e);
let _ = line_tx.send(format!("[forge] Log stream error: {}", e)).await;
break;
}
}
}
});