-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(core): expose workflow execution state #9034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c34178f
82e02a0
a644d0e
f519913
53d317b
9778f9e
04a7091
15895b8
1878baf
c8ef022
87fe9e1
c678df9
4b544d4
52a1e38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,8 @@ export function buildReplay(entries: JournalEntry[]): JournalReplay { | |
| * failure must not fail the dispatch). | ||
| */ | ||
| export class WorkflowJournal { | ||
| private pending = Promise.resolve(); | ||
|
|
||
| constructor(readonly path: string) {} | ||
|
|
||
| /** Load + parse all entries into replay maps. Empty maps if no file. */ | ||
|
|
@@ -194,6 +196,13 @@ export class WorkflowJournal { | |
|
|
||
| /** Append one entry. Rejects only on I/O error (callers `.catch`). */ | ||
| append(entry: JournalEntry): Promise<void> { | ||
| return writeLine(this.path, entry); | ||
| const operation = this.pending.then(() => writeLine(this.path, entry)); | ||
| this.pending = operation.catch(() => undefined); | ||
|
Comment on lines
+199
to
+200
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The chain-poisoning guard that isolates a failed append from all subsequent appends ( Add one test: make the first append reject (e.g. 中文说明[Suggestion] 隔离失败追加、保护后续所有追加的防中毒守卫( — qwen3.8-max via Qwen Code /review (v0.21.10)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deferred to the next round. Still planned: one journal test making the first append reject ( 中文说明延后至下一轮。仍计划:新增一个 journal 测试令首次 append 被拒绝(对 |
||
| return operation; | ||
| } | ||
|
|
||
| /** Wait until every append issued so far has settled. */ | ||
| drain(): Promise<void> { | ||
| return this.pending; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
toSnapshotnow persistssourceRunId/startMode(anddescription), butsnapshotToTask— the only reconstruction path from persisted data — never reads them back (descriptioncoincidentally survives via the identicalmeta?.name ?? runIdre-derivation). — Failure scenario: for a retry/rerun run, lineage is present in-session and on disk, butundefinedon every post-restart reconstruction — any consumer oftask.sourceRunId/task.startMode(the detail view, or the rerun flow these fields are staged for) sees lineage in-session and silentlyundefinedafter restart, even though the value sits in the snapshot file.中文说明
[Suggestion]
toSnapshot现在会持久化sourceRunId/startMode(以及description),但snapshotToTask——从持久化数据重建的唯一路径——从不读回它们(description只是碰巧通过相同的meta?.name ?? runId重新推导而幸存)。失败场景:对 retry/rerun 运行,血缘信息在会话内与磁盘上都存在,但每次重启后重建时都是undefined——任何task.sourceRunId/task.startMode的消费方(详情视图,或这些字段所预备的 rerun 流程)会话内能看到血缘、重启后却静默变为undefined,尽管值就保存在快照文件里。— qwen3.8-max via Qwen Code /review (v0.21.10)