Skip to content

fix: redirect streamed log lines without waiting for the next message - #1219

Merged
vdusek merged 4 commits into
masterfrom
claude/actor-log-redirect-test-o3z563
Nov 11, 2026
Merged

vdusek merged 4 commits into
masterfrom
claude/actor-log-redirect-test-o3z563

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
  • StreamedLog redirects each line once its newline arrives instead of holding the last message until the next one starts, for parity with the newer JS implementation.
  • Every platform log line starts with a timestamp, so a line is never a continuation of a message from an earlier chunk. Text before the first timestamp in a batch is dropped, which is safe for this reason. The redirected records stay the same as before, only without the delay.

`StreamedLog` now flushes every complete line instead of holding the last
message until the next one starts, matching the JS client. Lines of a
multi-line message that arrive in a later chunk are redirected as a separate
record at the level of the message they continue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAJXagvBd6TZVvVAYzM
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 10, 2026
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.74%. Comparing base (eb8ded4) to head (a4c9b39).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/apify_client/_streamed_log.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1219      +/-   ##
==========================================
- Coverage   95.76%   95.74%   -0.02%     
==========================================
  Files          63       63              
  Lines        6676     6671       -5     
==========================================
- Hits         6393     6387       -6     
- Misses        283      284       +1     
Flag Coverage Δ
integration 90.97% <92.30%> (+0.30%) ⬆️
unit 91.29% <92.30%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Every line of a platform log starts with a timestamp, so a chunk never
begins in the middle of a message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAJXagvBd6TZVvVAYzM

@apify-factory apify-factory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nothing blocking.

🏭 Factory review — ℹ️ not auto-approved

This change was reviewed but cannot be auto-approved: a gate failed, so the review cannot end in an approval.

check result
Static gates ❌ 15/16 — pr-open-and-ready
Review findings ✅ none
Reviewer escalation ✅ none
Juror 1 — claude-sonnet-5-5, adversarial ⏭️ skipped — a gate failed
Why it was not auto-approved

Failed gates:

  • pr-open-and-ready: PR is a draft

The comments above are the review itself; this section only explains the approval decision. Push a change and request @apify-factory again to re-run it, or ask a human to review.

Reviewed 70d3ae486 · workflow run

@Pijukatel
Pijukatel marked this pull request as ready for review November 10, 2026 15:33
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Nov 10, 2026

@apify-factory apify-factory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nothing blocking.

🏭 Factory review — ℹ️ not auto-approved

Redirecting on every newline can drop continuation lines of multi-line log messages, changing the redirected output.

check result
Static gates ✅ 16/16
Review findings ✅ none
Reviewer escalation ✅ none
Juror 1 — claude-sonnet-5-5, adversarial ❌ reject
Why it was not auto-approved

Juror 1 — claude-sonnet-5-5:

In src/apify_client/_streamed_log.py _log_buffer_content, a line is now treated as a complete message when its newline arrives, and each batch is split by the timestamp marker. Multi-line messages (e.g. tracebacks) have continuation lines with no timestamp. If such a line arrives in a later batch than its header line, it forms a batch with no marker, and re.split(...)[1:] discards it. Previously the continuation was part of the preceding message. This contradicts the claim that the redirected records are unchanged, and it also changes the public log output. Please handle continuation lines (e.g. keep the last message pending until a marker or end), add a test for a multi-line message split across chunks, and get a human review of the behavior change.

The comments above are the review itself; this section only explains the approval decision. Push a change and request @apify-factory again to re-run it, or ask a human to review.

Reviewed 70d3ae486 · workflow run

@Pijukatel Pijukatel added the adhoc Ad-hoc unplanned task added during the sprint. label Nov 11, 2026
@Pijukatel
Pijukatel requested a review from vdusek November 11, 2026 09:53
@vdusek vdusek changed the title refactor: redirect each streamed log line as soon as its newline arrives fix: redirect streamed log lines without waiting for the next message Nov 11, 2026

@vdusek vdusek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.

I also updated the PR title so it gets its changelog entry.

Comment thread src/apify_client/_streamed_log.py Resolved
Comment thread src/apify_client/_streamed_log.py Resolved
Comment thread tests/unit/test_logging.py Resolved
Comment thread tests/unit/test_logging.py Resolved
@vdusek

vdusek commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Merging this, since we want to release the next patch with #1214, and it makes sense to include the in-progress fixes in it. I hope that's fine.

@vdusek
vdusek merged commit ef066f8 into master Nov 11, 2026
36 of 37 checks passed
@vdusek
vdusek deleted the claude/actor-log-redirect-test-o3z563 branch November 11, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants