You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/10/15 19:18:58 UTC
[PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
davsclaus opened a new pull request, #27912:
URL: https://github.com/apache/camel/pull/27912
The runtime side of [CAMEL-25388](https://issues.apache.org/jira/browse/CAMEL-25388) step 2: the file transport of camel-cli-connector answers every action that has a request id, so the Camel CLI, the TUI and the MCP tools no longer wait for a timeout to find out an action failed, or that it worked.
### Answers
An action written to `~/.camel/<pid>-action-<requestId>.json` gets one of these in `~/.camel/<pid>-output-<requestId>.json`:
| Outcome | Answer |
|---|---|
| a result | the result, as before |
| unknown action, exception, reported error | `{"status":"failed","error":"..."}` |
| ... about something that does not exist | `{"status":"failed","error":"No route matching: x","reason":"not-found"}` |
| no result (route stop, gc, logger ...) | `{"status":"success"}` |
- `status:failed` + `error` is the shape the file transport has written for exceptions since 4.23, and the semantic commands of 4.23 read it.
- The shared `<pid>-action.json` / `<pid>-output.json` of older Camel CLI versions keeps its behaviour (the result, or the error of an exception). Those versions never read the other answers, and the next command could read one instead of its own result.
- `reason: not-found` lets the CLI exit with 3 (CAMEL-25389). It comes from the new `CliActionOutput.notFound(String)` (default: `error(message)`), used for "No route matching" and the new "No processor matching" (the processor action reported nothing before, not even its failures).
### Changes
- `CliActionOutcome` turns an action into an answer for both transports: the exception, an unknown or missing action, a reported error, or a result with status error/failed (message from `exception.message`, `error`, `message`, else "Action failed"). The WebSocket transport now shows the message of a failed result where it said "Action failed", and adds `reason` to its `result` frame.
- `FileCliConnectorTransport` writes the answer from it. An action file that cannot be read yet (empty, or half-written JSON from a CLI that writes in place) is retried for two seconds instead of dropped; after that, an action with a request id gets `Invalid action: ...`.
- Fixes [CAMEL-25386](https://issues.apache.org/jira/browse/CAMEL-25386): the MCP route tools (`RuntimeHelper.executeAction`) get `{"status":"success"}` for a route stop that worked, instead of "Timeout waiting for response", and the real error when no route matches. The TUI already removes the answer of a fired request.
### Docs
- `cli-connector.adoc`: a new "File transport" section with the answers, and `reason` in the WebSocket frame (catalog copy synced).
- 4.24 upgrade guide entry.
### Tests
- `FileCliConnectorTransportTest` (new, stub dispatcher): result, ack, unknown action, missing action, exception, reported error, not-found, invalid and half-written action files, and the shared action file keeping its behaviour.
- `CliActionOutcomeTest` (new): message from the result, unknown action, exception, not-found, and cancelling the outcome cancels the action.
- `LocalCliConnectorFileTransportTest`: an unknown action gets an error (was "ignored"), a route stop with a request id is acknowledged, an unknown route or processor is not found; the shared action file still writes nothing for a route stop.
- `WebSocketCliConnectorTransportTest`: the no-match route error and its reason.
- `mvn test` of camel-cli-connector: 68 tests pass.
The CLI side that waits for these answers and turns them into exit codes is CAMEL-25391 (`ActionClient`) and CAMEL-25393 (`camel cmd` actions).
_Claude Code on behalf of davsclaus_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27912:
URL: https://github.com/apache/camel/pull/27912#issuecomment-6200367772
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27912:
URL: https://github.com/apache/camel/pull/27912#issuecomment-6202017279
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `catalog/camel-catalog`
- `docs`
- `dsl/camel-cli-connector`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 9 of 705 tested, 23 compile-only — current: 9 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **9 affected modules** (current approach: 9).
**Skip-tests mode would test 9 modules** (3 direct + 8 downstream), **skip tests for 23** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (9)</summary>
- `camel-cli-connector` ← dsl/camel-cli-connector/src/main/docs/cli-connector.adoc, dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/CliActionOutcome.java, dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/CliActionOutput.java, dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/FileCliConnectorTransport.java, dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java, dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/WebSocketCliConnectorTransport.java, dsl/camel-cli-connector/src/test/java/org/apache/camel/cli/connector/CliActionOutcomeTest.java, dsl/camel-cli-connector/src/test/java/org/apache/camel/cli/connector/FileCliConnectorTransportTest.java, dsl/camel-cli-connector/src/test/java/org/apache/camel/cli/connector/LocalCliConnectorFileTransportTest.java, dsl/camel-cli-connector/src/test/java/org/apache/camel/cli/connector/WebSocketCliConnectorTransportTest.java
- `camel-cli-debug` ← downstream of org.apache.camel:camel-cli-connector
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
- `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
- `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
</details>
<details><summary>Modules with tests skipped (23)</summary>
- `apache-camel`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `camel-endpointdsl`
- `camel-endpointdsl-support`
- `camel-itest`
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-kamelet-main`
- `camel-launcher`
- `camel-report-maven-plugin`
- `camel-route-parser`
- `camel-yaml-dsl`
- `camel-yaml-dsl-deserializers`
- `camel-yaml-dsl-maven-plugin`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
<details><summary>All tested modules (34 modules, 4m 29s total)</summary>
**Total reactor time:** 4m 29s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: JBang :: Plugin :: TUI | 58.3s | SUCCESS |
| Camel :: Launcher | 31.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 29.0s | SUCCESS |
| Camel :: JBang :: MCP | 25.9s | SUCCESS |
| Camel :: Catalog :: Camel Catalog | 21.4s | SUCCESS |
| Camel :: YAML DSL :: Validator | 17.7s | SUCCESS |
| Camel :: Component DSL | 13.0s | SUCCESS |
| Camel :: YAML DSL | 11.3s | SUCCESS |
| Camel :: Docs | 10.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 9.3s | SUCCESS |
| Camel :: Kamelet Main | 7.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 4.7s | SUCCESS |
| Camel :: YAML DSL :: Deserializers | 4.6s | SUCCESS |
| Camel :: Catalog :: Camel Report Maven Plugin | 3.8s | SUCCESS |
| Camel :: Catalog :: Camel Route Parser | 3.6s | SUCCESS |
| Camel :: YAML DSL :: Maven Plugins | 2.3s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 2.2s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.7s | SUCCESS |
| Camel :: Assembly | 1.3s | SUCCESS |
| Camel :: Catalog :: Maven | 1.2s | SUCCESS |
| Camel :: Catalog :: Suggest (deprecated) | 1.2s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.2s | SUCCESS |
| Camel :: Coverage | 0.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 0.9s | SUCCESS |
| Camel :: Launcher :: Container | 0.6s | SUCCESS |
| Camel :: JBang :: Main | 0.6s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 0.6s | SUCCESS |
| Camel :: DSL :: CLI Debug | 0.5s | SUCCESS |
| Camel :: Endpoint DSL :: Support | 0.5s | SUCCESS |
| Camel :: Catalog :: Console | 0.4s | SUCCESS |
| Camel :: DSL :: CLI Connector | n/a | |
| Camel :: Endpoint DSL | n/a | |
| Camel :: Integration Tests | n/a | |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: JBang :: Plugin :: TUI` (58.3s)
- `Camel :: Launcher` (31.8s)
- `Camel :: JBang :: Plugin :: Validate` (29.0s)
- `Camel :: JBang :: MCP` (25.9s)
- `Camel :: Catalog :: Camel Catalog` (21.4s)
- `Camel :: YAML DSL :: Validator` (17.7s)
- `Camel :: Component DSL` (13.0s)
- `Camel :: YAML DSL` (11.3s)
- `Camel :: Docs` (10.9s)
- `Camel :: JBang :: Plugin :: Kubernetes` (9.3s)
- `Camel :: Kamelet Main` (7.3s)
- `Camel :: JBang :: Plugin :: Testing` (4.7s)
- `Camel :: YAML DSL :: Deserializers` (4.6s)
- `Camel :: Catalog :: Camel Report Maven Plugin` (3.8s)
- `Camel :: Catalog :: Camel Route Parser` (3.6s)
- `Camel :: YAML DSL :: Maven Plugins` (2.3s)
- `Camel :: YAML DSL :: Validator Maven Plugin` (2.2s)
- `Camel :: JBang :: Integration tests` (1.7s)
- `Camel :: Assembly` (1.3s)
- `Camel :: Catalog :: Maven` (1.2s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38796540416)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27912:
URL: https://github.com/apache/camel/pull/27912#discussion_r4287506689
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/FileCliConnectorTransport.java:
##########
@@ -237,18 +264,45 @@ private void finishAction(File request, PendingAction action) {
}
}
- private static JsonObject loadAction(File file) {
+ /**
+ * The reply to an action: its result, the error, or an ack. The shared output file only gets the result, or the
+ * error of an exception (as before 4.24), so the next command does not read a reply meant for another command.
+ */
+ private static JsonObject reply(CliActionOutcome outcome, boolean replyAlways) {
+ if (outcome.result() != null) {
+ return outcome.result();
Review Comment:
⚠️ **Partial result masks exception (file transport only):** `result()` is checked first, so if an action sets a partial result *and* then throws, this path returns the result and silently drops the error. `WebSocketCliConnectorTransport` sends both fields. Unlikely with current actions (most do one or the other), but the code path is live via `CliActionOutcome.of()`.
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java:
##########
@@ -1461,8 +1465,12 @@ private void doActionProcessorTask(JsonObject root) {
} catch (Exception e) {
LOG.warn("Error {} processor: {} due to: {}. This exception is ignored.", command, mp.getProcessorId(),
e.getMessage(), e);
+ reportError("Error " + command + " processor: " + mp.getProcessorId() + " due to: " + e.getMessage());
Review Comment:
⚠️ **Last-error-wins in loop:** `Collector.error()` is a plain field overwrite (`this.error = message`). If multiple processors match the pattern and several throw, only the last error is reported to the caller. Low impact in practice, but multi-processor failures are silently collapsed. Same pattern exists in `doActionRouteTask`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27912:
URL: https://github.com/apache/camel/pull/27912
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25390: camel-cli-connector - Always reply to CLI actions, including errors and acks [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27912:
URL: https://github.com/apache/camel/pull/27912#discussion_r4287552890
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/FileCliConnectorTransport.java:
##########
@@ -237,18 +264,45 @@ private void finishAction(File request, PendingAction action) {
}
}
- private static JsonObject loadAction(File file) {
+ /**
+ * The reply to an action: its result, the error, or an ack. The shared output file only gets the result, or the
+ * error of an exception (as before 4.24), so the next command does not read a reply meant for another command.
+ */
+ private static JsonObject reply(CliActionOutcome outcome, boolean replyAlways) {
+ if (outcome.result() != null) {
+ return outcome.result();
Review Comment:
Fixed in 6a1aefecd098: an exception, an unknown action or a reported error now wins over a (partial) result. The file transport answers `{"status":"failed","error":"..."}` and keeps the result the action wrote before it failed under `"result"`, so nothing is lost and it matches the WebSocket frame, which sends both. (Before this PR an exception also replaced a partial result.) A result that reports a failure of its own, such as `{"status":"error","message":...}` from `cmd sql`, is still written as it is, because the CLI reads those. `FileCliConnectorTransportTest.exceptionWinsOverAPartialResult`, `reportedErrorWinsOverAResult` and `resultWithAFailureOfItsOwnIsWrittenAsItIs` cover it.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java:
##########
@@ -1461,8 +1465,12 @@ private void doActionProcessorTask(JsonObject root) {
} catch (Exception e) {
LOG.warn("Error {} processor: {} due to: {}. This exception is ignored.", command, mp.getProcessorId(),
e.getMessage(), e);
+ reportError("Error " + command + " processor: " + mp.getProcessorId() + " due to: " + e.getMessage());
Review Comment:
Fixed in 6a1aefecd098: the collector keeps every reported problem and joins them with `; ` (for example `Error stop route: a due to: x; Error stop route: b due to: y`), so this holds for the route action too. `reason` is `not-found` only when every reported problem is a not-found. `CliActionOutcomeTest.severalProblemsAreJoined` and `notFoundOnlyWhenEveryProblemIsNotFound` cover it.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org