feat(java): report executor progress, logs and toggles over the side-channel - #602
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThe PR adds Java ChangesJava executor side-channel integration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant TaskHandler
participant JobContext
participant NativeExecutor
participant JavaDispatcher
participant Scheduler
TaskHandler->>JobContext: report progress or write task log
JobContext->>NativeExecutor: invoke native operation
NativeExecutor->>JavaDispatcher: forward JNI request
JavaDispatcher->>Scheduler: send side-channel event
Scheduler-->>JavaDispatcher: acknowledge executor communication
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sdks/java/src/main/java/org/byteveda/taskito/JobContext.java (1)
100-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a
TaskLogLeveloverload toJobContext.log.
log(String level, ...)exposes a caller-chosen closed-set level as a raw string. The SDK already usesTaskLogLevelforwriteTaskLog, so add a matchinglog(TaskLogLevel level, ...)overload inJobContextand keep the existing string overload for compatibility.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sdks/java/src/main/java/org/byteveda/taskito/JobContext.java` around lines 100 - 108, Add a JobContext.log overload accepting TaskLogLevel alongside the existing string-based overload, and delegate it to sink.writeTaskLog using the enum level. Preserve the current log(String, String, `@Nullable` String) method unchanged for compatibility, including the convenience log(String) behavior.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@sdks/java/src/main/java/org/byteveda/taskito/JobContext.java`:
- Around line 100-108: Add a JobContext.log overload accepting TaskLogLevel
alongside the existing string-based overload, and delegate it to
sink.writeTaskLog using the enum level. Preserve the current log(String, String,
`@Nullable` String) method unchanged for compatibility, including the convenience
log(String) behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 70d03d02-8c42-408e-afe5-45d35742fcea
📒 Files selected for processing (12)
crates/taskito-java/src/dispatcher.rscrates/taskito-java/src/executor.rssdks/java/src/main/java/org/byteveda/taskito/JobContext.javasdks/java/src/main/java/org/byteveda/taskito/internal/JniExecutorControl.javasdks/java/src/main/java/org/byteveda/taskito/internal/MiddlewareDisables.javasdks/java/src/main/java/org/byteveda/taskito/internal/NativeExecutor.javasdks/java/src/main/java/org/byteveda/taskito/spi/WorkerBridge.javasdks/java/src/main/java/org/byteveda/taskito/spi/WorkerControl.javasdks/java/src/main/java/org/byteveda/taskito/worker/WorkerDispatchBridge.javasdks/java/src/main/resources/META-INF/native-image/org.byteveda/taskito/jni-config.jsonsdks/java/src/test/java/org/byteveda/taskito/worker/ExecutorAttachTest.javasdks/java/test-support/src/main/java/org/byteveda/taskito/test/InMemoryQueueBackend.java
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
ByteVeda/taskito(manual)
Same API under a worker and an attached executor; only where the write lands differs.
71b8c1f to
875375b
Compare
|
Applied in f214d47, with one deviation from the suggestion.
public void log(String message) // info convenience, unchanged
public void log(TaskLogLevel level, String message)
public void log(TaskLogLevel level, String message, @Nullable String extra)The deviation: the suggestion was to keep the string-typed overload for compatibility. I removed it instead.
|
Part 4 of #589 and the last SDK, on top of #599 (core), #600 (Python) and #601 (Node). A task running on an attached Java executor gets its progress, its task logs, its published partials and its dashboard middleware toggles back, without the executor holding a database connection.
What changes
JobContext— the API a handler actually usesNew ambient context, resolved per thread through the existing
ScopeContext:Identical under a
Workerand an attachedExecutor, which is the point: only the route differs. A worker writes straight to its own storage; an executor reports to the scheduler, which applies the write. A task cannot tell, and should not have to. Every method is best-effort — losing a progress update is a degradation, failing the job over one would not be, so nothing here throws.The dispatch carries more
WorkerBridge.onJobgrowsmetadataJsonanddisabledMiddlewareJson. Middleware reads job metadata, and an executor cannot fetch the row; the toggle list is resolved by the scheduler for the same reason.MiddlewareDisablesdecodes the list, andWorkerDispatchBridgeapplies it per dispatch rather than per task name.The executor reports back
NativeExecutorgainsreportProgressandwriteTaskLognatives, backed by the session'sExecutorSideChannel.JniExecutorControlroutes a job's writes there, soJobContext's sink is the side channel under an executor and storage under a worker.One thing worth calling out
jni-config.jsonwas stale.onJob's JNI upcall went from four parameters to six, and the shipped reachability metadata still registered the four-parameter form. The JVM build does not notice —./gradlew buildpasses either way — but undernative-imagethe six-argumentonJobwould not have been registered for JNI, and the smoke binary would have failed at its first dispatch. Fixed in71b8c1f; the built jar was checked to ship the corrected entry.I could not run
:graalvm-smoke:nativeCompilelocally — no GraalVM on this machine — so that CI leg is the first real exercise of it. The newnativemethods onNativeExecutorare downcalls and need no metadata, consistent with the existing ones, none of which appear in the config either.Tests
sendsProgressAndLogsToASchedulerThatAdvertisedTheSideChannelsendsNothingToASchedulerThatAdvertisedNoSideChannelskipsAMiddlewareTheDispatchSaysIsDisabledmiddlewareReadsMetadataOffTheDispatchVerification
cargo test --workspace,cargo clippy --all-targets --all-features -- -D warningsandcargo fmt --checkare clean../gradlew build -x cargoBuildis green — Spotless, Checkstyle and the full suite at 515 tests, 0 failures, up from 487 on master.Refs #589.
Summary by CodeRabbit
New Features
Bug Fixes