Skip to content

fix: preserve cloud tickets and per-job log offsets - #623

Open
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/issue-614-cloud-ticket-log-offsets
Open

fix: preserve cloud tickets and per-job log offsets#623
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/issue-614-cloud-ticket-log-offsets

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #614

Summary

  • preserve Client(ticket=...) when BOHR_TICKET is unset or empty
  • apply a non-empty environment ticket as a temporary request-time override without mutating the configured ticket
  • track cloud log byte offsets independently for each normalized job ID
  • add mocked regression tests for ticket precedence, password-login fallback, and alternating job logs

Validation

  • python -m coverage run -p --source=./dpdispatcher -m unittest (169 passed, 42 skipped)
  • python -m coverage combine && python -m coverage report (49% total)
  • pre-commit run --all-files
  • uvx ty check --python /tmp/dpdispatcher-validation-venv/bin/python --python-version 3.13
  • dpdisp --help
  • python -m dpdispatcher -h
  • make html in doc/ (succeeded with existing warnings)
  • pyright was attempted, but its local wrapper could not provision a Node runtime; the repository's current ty check passes

Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh

Summary by CodeRabbit

  • Bug Fixes

    • Improved authentication ticket handling across requests and token refreshes.
    • Environment-provided tickets are now applied consistently when available.
    • Log streaming now tracks progress independently for each job, preventing one job’s completed logs from affecting another.
  • Tests

    • Added coverage for ticket selection, login behavior, and independent multi-job log retrieval.

Preserve caller-provided Bohrium tickets when the environment does not supply a non-empty override, and keep log download offsets independently for each job.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 18, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.64%. Comparing base (e23bb8c) to head (8af3a53).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #623      +/-   ##
==========================================
+ Coverage   48.38%   49.64%   +1.26%     
==========================================
  Files          40       40              
  Lines        3960     3970      +10     
==========================================
+ Hits         1916     1971      +55     
+ Misses       2044     1999      -45     

☔ 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.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@njzjz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d42c9b1d-23c2-49f1-8cdd-ef11ce9fb77d

📥 Commits

Reviewing files that changed from the base of the PR and between 0cf24f9 and 8af3a53.

📒 Files selected for processing (2)
  • dpdispatcher/utils/dpcloudserver/client.py
  • tests/test_dpcloudserver_client.py
📝 Walkthrough

Walkthrough

The cloud client centralizes ticket selection, avoids unnecessary login when a ticket is available, and tracks log download offsets independently for each job. New tests cover ticket precedence, password login, request headers, and multi-job log polling.

Changes

Cloud client behavior

Layer / File(s) Summary
Ticket resolution and login flow
dpdispatcher/utils/dpcloudserver/client.py, tests/test_dpcloudserver_client.py
Ticket selection is centralized across request headers and token refresh, with tests for explicit tickets, environment overrides, and password login.
Per-job log offset tracking
dpdispatcher/utils/dpcloudserver/client.py, tests/test_dpcloudserver_client.py
Log range requests maintain separate byte offsets per job, with tests covering independent reads and completion state.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: preserving cloud tickets and per-job log offsets.
Linked Issues check ✅ Passed The changes match #614 by preserving explicit tickets, avoiding unintended login, and tracking log offsets per job.
Out of Scope Changes check ✅ Passed The PR stays focused on ticket handling and log-offset fixes, with only targeted regression tests added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@dpdispatcher/utils/dpcloudserver/client.py`:
- Around line 281-286: Update the requests.get call in the log polling method to
pass the established HTTP_TIME_OUT value and validate the response before using
resp.content. Raise or otherwise handle unsuccessful responses so error payloads
are not returned or counted in self.last_log_offsets, and update
request_get.call_args_list test assertions to include the timeout argument.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0b5cf4d-4e38-451d-9957-39ed3a880e46

📥 Commits

Reviewing files that changed from the base of the PR and between e23bb8c and 0cf24f9.

📒 Files selected for processing (2)
  • dpdispatcher/utils/dpcloudserver/client.py
  • tests/test_dpcloudserver_client.py

Comment thread dpdispatcher/utils/dpcloudserver/client.py

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The ticket preservation and per-job offset split are sound, but one unresolved log-fetch reliability issue remains: failed or unbounded HTTP requests can hang polling and corrupt the new per-job offset. I independently confirmed the existing unresolved thread; the actionable fix is inline.

This PR is authored by the reviewing account, so this is a comment review rather than a self-requested change.

Review context: Codex's quota is close to resetting, so I'm deliberately spending the remaining tokens on reviewing the open PR queue now.

Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh

Comment thread dpdispatcher/utils/dpcloudserver/client.py Outdated
Add timeouts and preserve per-job offsets when remote log requests fail.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Preserve explicit cloud tickets and per-job log offsets

2 participants