Skip to content

fix(compose): legacy interrupt wrapping with BatchResumeWithData - #1269

Open
JopenChen wants to merge 1 commit into
cloudwego:mainfrom
JopenChen:fix/legacy-interrupt-resume
Open

fix(compose): legacy interrupt wrapping with BatchResumeWithData#1269
JopenChen wants to merge 1 commit into
cloudwego:mainfrom
JopenChen:fix/legacy-interrupt-resume

Conversation

@JopenChen

@JopenChen JopenChen commented Sep 9, 2026

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: (optional scope):
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level.

(Optional) Translate the PR title into Chinese.

fix(compose): 修复 legacy interrupt 与 BatchResumeWithData 不兼容的问题

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
Fix the incompatibility between legacy interrupt errors (InterruptAndRerun, NewInterruptAndRerunErr) wrapped via WrapInterruptAndRerunIfNeeded and the BatchResumeWithData resume mechanism.

There was a TODO at compose/resume_test.go:1096 noting that legacy interrupt wrapping does not work correctly with BatchResumeWithData - the graph re-interrupts instead of completing.

Root cause: CompositeInterrupt generated a new random UUID for each legacy interrupt on every invocation. Since BatchResumeWithData matches resume data by interrupt ID, the IDs from the first invocation no longer matched after a re-run.

Fix: Use the deterministic address string (wrapped.ps.String()) as the ID for legacy interrupts instead of uuid.NewString(). Addresses are stable across re-runs, ensuring resume data correctly matches the interrupt point.

Also updated the test to use IDs from the most recent invocation (modern Interrupt() still uses random UUIDs), and removed the unused uuid import.

zh(optional):
修复通过 WrapInterruptAndRerunIfNeeded 包装的 legacy 中断错误(InterruptAndRerun、NewInterruptAndRerunErr)与 BatchResumeWithData 恢复机制不兼容的问题。

compose/resume_test.go:1096 处原有 TODO 标注 legacy interrupt wrapping 与 BatchResumeWithData 不能正常工作——图会重新中断而非完成执行。

根本原因:CompositeInterrupt 每次调用都为每个 legacy 中断生成新的随机 UUID。由于 BatchResumeWithData 按中断 ID 匹配恢复数据,重新运行后第一次调用的 ID 不再匹配。

修复方案:使用确定性的地址字符串(wrapped.ps.String())作为 legacy 中断的 ID,替代 uuid.NewString()。地址在多次运行间保持稳定,确保恢复数据能正确匹配到中断点。

同时更新了测试以使用最近一次调用的 ID(现代 Interrupt() 仍使用随机 UUID),并移除了未使用的 uuid 导入。

(Optional) Which issue(s) this PR fixes:

N/A (resolves internal TODO)

(optional) The PR that updates user documentation:

N/A

Fix the incompatibility between legacy interrupt errors (InterruptAndRerun,
NewInterruptAndRerunErr) wrapped via WrapInterruptAndRerunIfNeeded and the
BatchResumeWithData resume mechanism.

Root cause: CompositeInterrupt generated a new random UUID for each legacy
interrupt on every invocation. Since BatchResumeWithData matches resume data
by interrupt ID, the IDs from the first invocation no longer matched after a
re-run, causing the graph to re-interrupt instead of completing.

Fix: Use the deterministic address string (wrapped.ps.String()) as the ID
for legacy interrupts instead of uuid.NewString(). Addresses are stable
across re-runs, ensuring resume data correctly matches the interrupt point.

Changes:
- Replace uuid.NewString() with wrapped.ps.String() in CompositeInterrupt
  for both deprecatedInterruptAndRerun and InterruptSignal cases
- Remove unused github.com/google/uuid import
- Update TestLegacyInterrupt to assert successful resume instead of error

Resolves the TODO at compose/resume_test.go:1096
@CLAassistant

CLAassistant commented Sep 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants