You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(logging): the execution log records a row's outcome after its output is validated (ITL-1261) - #640
Record a successful execution after its output passes validation. A rejected output records failure and, when the executor supplies a traceback field, the validation traceback alongside the captured I/O.
Cover wrong output types and wrong output counts on both the sync and async job paths.
The fix uses the existing log columns, and the golden hash check passed. For this PR and #628, whichever merges second should merge main after the first lands.
Fixes ITL-1261
Review findings and regression coverage
Finding
Regression coverage
A lone surrogate in a validation error prevented a UTF-8 log write and masked the row's error.
test_validation_traceback_with_lone_surrogate checks the escaped traceback, the failure log row, and the original ValueError on sync and async jobs. Both cases failed with UnicodeEncodeError before the fix.
The rejection tests used a single tag and data column in one layout.
test_rejected_output_logged_as_failure checks wrong types and wrong output counts across two tag columns, two data columns, and two physical column and tag orders on sync and async jobs.
A custom executor that omits the traceback field can log a rejected row without its validation reason.
The reproduction below records the current behavior. Adding a field to the stored log is outside this patch's scope.
Known limitations
A custom executor's log can omit the validation reason if its record has no field for it. To reproduce, use LoggingObserver with an in-memory database and a custom executor that calls the function, records logger.record(success=True, stdout_log="capture"), and returns the result. Supply one integer and one string return from a function declared to return int. The rejected row has _log_success=False and the captured stdout. The job summary reports OutputTypeError. Adding a traceback column to only the rejected record makes its schema incompatible with the successful record in the same table.
Summary by CodeRabbit
Bug Fixes
Execution logs now mark runs as failed when their outputs fail validation, rather than recording them as successful.
Failure logs include validation details and captured output, making it easier to understand what went wrong. Error messages containing unusual Unicode characters are stored safely.
The fix applies to both synchronous and asynchronous execution.
Documentation
Clarified a limitation: some custom execution setups may not include the validation reason in the failure log, though it remains available in the job summary.
No actionable comments were generated in the recent review.
Walkthrough
The change defers successful execution-log records until output validation completes. If execution or validation raises, buffered records become failures and include a traceback when the record has a traceback field. Synchronous and asynchronous paths use this behavior, with integration tests and documentation covering the results.
Changes: Execution logging
Layer / File(s)
Summary
Defer success records through output validation src/orcapod/core/data_function.py
A deferred logger buffers success records until execution and output validation complete. If an exception occurs, buffered records become failures, receive the current traceback when they already have a traceback field, and are forwarded before the exception is re-raised. Both synchronous and asynchronous executor paths use this behavior.
Verify and document failure records tests/test_pipeline/test_logging_observer_integration.py, changelog.d/ITL-1261.md, docs/dev/design_issues/ITL-1261-OBS1261.md
Integration tests cover rejected outputs, captured stdout, retained tags, and traceback escaping for lone surrogates in both orchestrator modes. The changelog and design-issue document describe the fix and the custom-executor limitation.
sequenceDiagram
participant PythonDataFunction
participant Executor
participant DeferredSuccessLogger
participant OutputValidation
participant ExecutionLog
PythonDataFunction->>Executor: Execute with deferred logger
Executor->>DeferredSuccessLogger: Submit success record
DeferredSuccessLogger->>DeferredSuccessLogger: Buffer success record
PythonDataFunction->>OutputValidation: Validate output
OutputValidation-->>PythonDataFunction: Raise validation exception
PythonDataFunction->>DeferredSuccessLogger: Mark buffered record as failed
DeferredSuccessLogger->>ExecutionLog: Forward failure record and traceback
Loading
Possibly related issues
Issue #252 also concerns recording failed pods in the async path. This change logs rejected outputs as failures, but does not change pod status handling or async error propagation.
Merge Risk: Minimal · up to b8dc2
Rejected function outputs are now logged as failures instead of successes, with validation tracebacks when the executor supports them. No merge-blocking risk was identified. Custom executors without a traceback field may omit the validation reason, and this is documented.
Security architecture risk: Low · up to b8dc2
The change fixes misleading success records for rejected outputs. It also lets validation exception text reach existing execution logs and can leave a record unwritten if the invocation is interrupted before the log is written. It does not add a new log destination or grant new access.
Retained concerns
Low · security · inferred: At base, a callable that returned normally could leave a success record with no traceback even when its output was rejected. At head, the validation exception text is appended to the same execution log when the executor supplied a traceback field. Validation callbacks can emit data-dependent messages; UTF-8 escaping preserves that text rather than redacting it. Sensitive content in those messages would become visible to existing log readers. No broader reader access or actual sensitive disclosure was established.
Low · reliability · observed: An interruption outside the Exception hierarchy after a success record has been buffered skips both flush paths. The base had already handed that record to the logger; the head can leave no record for that buffered outcome. This is relevant to executors that can suspend after recording success and to interruptions during validation. The inspected built-in async paths do not suspend after recording success.
Low · reliability · observed: The new failure flush calls the logger before re-raising the validation error. If the logger raises, callers receive the logger exception with the validation error chained behind it, and any remaining buffered records are skipped. The built-in observer catches database append exceptions, so this propagation concerns errors outside that guard and custom loggers that raise.
Security review details
Security Blast Radius
inferred — The new content is limited to logged invocations with a buffered success containing a traceback field and a subsequent exception. Local and Ray both supply that field. Exposure follows the configured observer database and its existing readers; node-scoped paths do not by themselves establish tenant isolation.
Trust Boundaries and Controls
observed — The wrapper forwards records to the original invocation logger, preserving its run, tag, and storage context. It does not grant access to a different sink. The traceback encoding step ensures UTF-8 compatibility, not confidentiality.
Hardening Proposals
proposed — Persist a bounded, structured validation diagnostic by default. Make full exception text opt-in under the applicable log access and retention policy.
proposed — Define what happens to a buffered outcome on cancellation and logger failure. Preserve the primary validation error if recording also fails, and test interruption and partial flush behavior explicitly.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the execution log now records a row's outcome only after its output passes validation, and it references the ticket ITL-1261. The raw summary confirms the data_functio…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the execution log now records a row's outcome only after its output passes validation, and it references the ticket ITL-1261. The raw summary confirms the data_function.py change defers success records until validation completes, and the tests cover rejected output as failures. The title is specific and accurate, though it is somewhat long at 96 characters.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Limit details: You’ve used the included review currently available. Your 96 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
Recent review details
Context from checks skipped due to timeout: 2
GitHub Check: CodeRabbit
GitHub Check: Tests (3.13)
Additional context used
Code guidelines: 1
CLAUDE.md — auto-discovered
Path-based instructions: 1
Source excerpt: A pull request never edits `CHANGELOG.md` (developer, November 11, 2026; ITL-961).
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The fix uses the existing log columns, and the golden hash check passed. For this PR and #628, whichever merges second should merge
mainafter the first lands.Fixes ITL-1261
Review findings and regression coverage
test_validation_traceback_with_lone_surrogatechecks the escaped traceback, the failure log row, and the originalValueErroron sync and async jobs. Both cases failed withUnicodeEncodeErrorbefore the fix.test_rejected_output_logged_as_failurechecks wrong types and wrong output counts across two tag columns, two data columns, and two physical column and tag orders on sync and async jobs.Known limitations
A custom executor's log can omit the validation reason if its record has no field for it. To reproduce, use
LoggingObserverwith an in-memory database and a custom executor that calls the function, recordslogger.record(success=True, stdout_log="capture"), and returns the result. Supply one integer and one string return from a function declared to returnint. The rejected row has_log_success=Falseand the captured stdout. The job summary reportsOutputTypeError. Adding a traceback column to only the rejected record makes its schema incompatible with the successful record in the same table.Summary by CodeRabbit