-
Notifications
You must be signed in to change notification settings - Fork 0
[upstream-sync] Component run_in_background() error callback (upstream PR #1754) #136
Description
Upstream Change Summary
Type: new-feature
Difficulty: Medium
Recommendation: Adapt
Upstream PR #1754 adds scope-level and environment-level exception handlers for background mount() failures. The Rust core change is in rust/core/src/engine/component.rs: Component::run_in_background() now accepts an optional async on_error callback instead of unconditionally logging errors. This is a meaningful API extension to the component execution engine.
The broader Python-side exception handler chaining (ExceptionContext, ExceptionHandler, coco.exception_handler()) is irrelevant to recoco, but the Rust signature change to run_in_background() may affect recoco's component API and background execution model.
Upstream References
- PR: Feat: Mount exception handler cocoindex-io/cocoindex#1754
- Upstream repo: https://github.com/cocoindex-io/cocoindex
Relevant Upstream Files / Areas
rust/core/src/engine/component.rs→crates/recoco-core/src/execution/component modulerust/py/src/component.rs→ skip (PyO3 bindings)- All other files (
python/,docs/) → skip
Recoco Considerations
- Affected modules:
crates/recoco-corecomponent execution, specificallyrun_in_background() - Python exclusions: Do not port
ExceptionContext,ExceptionHandler,coco.exception_handler(),EnvironmentBuilder.set_exception_handler(), or any Python API surface - Adaptation needed: The
run_in_background()signature change should be adopted in pure-Rust form — likely as an optionalon_error: Option<impl FnOnce(Error) + Send + 'static>callback or a more idiomatic Rust error-channel approach - API surface impact: If
run_in_background()or background component execution is exposed in recoco's public API, this may require a minor version bump - Feature-gating: No new ops, no new feature gate needed
- Opportunity: Consider whether recoco should expose a richer error-handling API for background flows (e.g., returning a
JoinHandleor using a broadcast channel for errors) rather than mirroring the callback pattern
Integration Notes
The key question is whether recoco's run_in_background() equivalent currently swallows errors or propagates them. If it already returns a JoinHandle<Result<...>>, this upstream change may be partially covered. Review the current implementation before adopting. The Python-specific handler chaining logic should be entirely omitted.