Skip to content

fix(algorithm): harden chart generation against per-subsection failures - #16

Open
QingCheng24 wants to merge 1 commit into
openJiuwen-ai:mainfrom
QingCheng24:fix/algorithm-report-chart-robustness
Open

fix(algorithm): harden chart generation against per-subsection failures#16
QingCheng24 wants to merge 1 commit into
openJiuwen-ai:mainfrom
QingCheng24:fix/algorithm-report-chart-robustness

Conversation

@QingCheng24

@QingCheng24 QingCheng24 commented Jul 23, 2026

Copy link
Copy Markdown

Paired: GitHub #16GitCode !323

What type of PR is this?

/kind

What does this PR do / why do we need it:

  • Prevent a single failing H2 subsection from crashing an entire H1 section during chart-task generation:
    • _process_section_h2 now returns [] on its exception path instead of falling off the end and returning None.
    • _process_section_h1 skips any non-list gather result (None, or an Exception surfaced by return_exceptions=True) before extend(), avoiding a TypeError that turned a recoverable per-subsection error into a full-section crash.
  • Also fix a latent regex bug in _remove_reference_section: the boundary pattern was built with an f-string, so #{1, 6} was interpolated as the tuple (1, 6) instead of the quantifier #{1,6}. Behavior is unchanged today (the match end is not used by the current slicing), but the regex now means what it reads; this removes a trap for future edits.
  • Adds regression tests for the chart H1/H2 error handling.

Which issue(s) this PR fixes:

N/A (no tracked issue)

What scenarios were tested, and what were the verification results (Function, performance, reliability, etc.):

  • Function — New unit tests in tests/algorithm/chart_generation/test_figure_placeholders_h1_resilience.py:
    • test_process_section_h2_returns_empty_list_on_llm_error: a failing call_model yields [], never None.
    • test_process_section_h1_skips_none_and_exception_results: with subsection results [good_task, None, RuntimeError], aggregation returns only the good task (chart_id_in_section=1) and does not raise TypeError.
  • Reliability — Before the fix, one failed H2 LLM call aborted the whole H1 section (and, via gather(return_exceptions=True), propagated an Exception object downstream); after the fix, failed subsections are skipped and remaining charts are still generated.
  • Regression / no side effects:
    • pytest tests/algorithm/chart_generation tests/source_tracer -> 55 passed.
    • Full run across the three touched subsystems -> 378 passed (1 pre-existing failure test_simple_react_telemetry_uses_built_tool_map, confirmed failing on clean main, unrelated to this PR).
    • python -m compileall openjiuwen_deepsearch server -> clean.
  • Performance — No impact (adds only a type check per subsection result).

Self-checklist:

    • Design: Has the solution corresponding to the PR been reviewed by the Maintainer, and have all review comments been replied to and revised
    • Test: Has the code in the PR been fully covered by UT/ST test cases, and have the newly added test cases been uploaded to the repository along with this PR or already uploaded.
    • Verification: Does the PR description contains a detailed description of the verification results regarding the achievement of the expected goals for the Feature, Refactor, and Bugfix to this PR.
    • Interface: Does it involve changes to external interfaces? (No external interface / public SDK / API changes.)
    • Document: Does it involve modifications to the official website documentation? (No — the documented chart-generation contract is unchanged; this is an internal robustness fix.)

@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@openjiuwen-ci-bot

Copy link
Copy Markdown

Hi @QingCheng24, thanks for your contribution!

This pull request is currently waiting for the CLA Assistant check to pass before the CI process can continue.

Please follow the signing link shown by CLA Assistant on this PR. If you have already signed the CLA but the check is still failing, please make sure that all email addresses used in your commits are added to and verified on your GitHub account.

After updating your email settings or signing the CLA, please click Recheck in the CLA Assistant comment/check so the status can be refreshed.

Once the CLA Assistant check passes, CI will continue automatically.

@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 479bd6a5da01d98bd69fcee9ce52a42c066bf673

任务名称 结果 日志操作
静态检查 ❌FAILED 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ❌FAILED 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

Prevent a single failing H2 subsection from crashing an entire H1 section
during chart-task generation:

- _process_section_h2 now returns [] on its exception path instead of
  falling off the end and returning None.
- _process_section_h1 skips any non-list gather result (None, or an
  Exception surfaced by return_exceptions=True) before extend(), avoiding
  a TypeError that turned a recoverable per-subsection error into a full
  section crash.

Also fix a latent regex bug in _remove_reference_section: the boundary
pattern was built with an f-string, so `#{1, 6}` was interpolated as the
tuple (1, 6) instead of the quantifier `#{1,6}`. Behavior is unchanged
today (the match end is not used by the current slicing), but the regex
now means what it reads; this removes a trap for future edits.

Adds regression tests for the chart H1/H2 error handling.
@QingCheng24
QingCheng24 force-pushed the fix/algorithm-report-chart-robustness branch from 479bd6a to 9ad7f84 Compare August 7, 2026 12:36
@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 9ad7f840ccfa83a1affb3fb6e068cd0f5bc6217e

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants