@linxin666/dsh-client-ui-task-board 0.4.15 → 0.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +17 -37
  3. package/README.zh.md +17 -37
  4. package/lib/client.js +136 -1347
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +166 -2529
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -20
  8. package/lib/types/client/board/ExecutionLog.d.ts +8 -0
  9. package/lib/types/client/board/status-key.d.ts +0 -15
  10. package/lib/types/client/locales.d.ts +2 -110
  11. package/lib/types/core/controller.d.ts +1 -1
  12. package/lib/types/core/extension.d.ts +4 -5
  13. package/lib/types/core/model-catalog.d.ts +58 -0
  14. package/lib/types/core/reasoning-effort.d.ts +1 -1
  15. package/lib/types/core/subtask.d.ts +31 -0
  16. package/lib/types/core/tasks.d.ts +0 -45
  17. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  18. package/lib/types/host/llm-dispatch.d.ts +8 -10
  19. package/lib/types/host-ledger.d.ts +0 -28
  20. package/lib/types/host-runner.d.ts +15 -71
  21. package/lib/types/host-service.d.ts +25 -89
  22. package/lib/types/index.d.ts +0 -78
  23. package/lib/types/protocol.d.ts +6 -23
  24. package/package.json +26 -26
  25. package/src/client/TaskBoardSettingsCard.tsx +13 -200
  26. package/src/client/board/ExecutionLog.tsx +17 -6
  27. package/src/client/board/NewTaskModal.tsx +1 -42
  28. package/src/client/board/TaskCard.tsx +2 -7
  29. package/src/client/board/TaskDetail.tsx +2 -37
  30. package/src/client/board/status-key.ts +0 -30
  31. package/src/client/board-settings.module.css +3 -22
  32. package/src/client/board.module.css +1 -104
  33. package/src/client/index.ts +1 -1
  34. package/src/client/locales.ts +8 -224
  35. package/src/core/controller.ts +1 -3
  36. package/src/core/extension.ts +4 -5
  37. package/src/core/model-catalog.ts +114 -0
  38. package/src/core/reasoning-effort.ts +1 -1
  39. package/src/core/store.ts +22 -17
  40. package/src/core/subtask.ts +36 -0
  41. package/src/core/tasks.ts +0 -53
  42. package/src/core/use-cases/task-update.ts +1 -8
  43. package/src/host/agent-tools.ts +1 -15
  44. package/src/host/llm-dispatch.ts +8 -10
  45. package/src/host-ledger.ts +1 -86
  46. package/src/host-routes.ts +4 -4
  47. package/src/host-runner.ts +33 -139
  48. package/src/host-service.ts +60 -266
  49. package/src/index.ts +27 -164
  50. package/src/protocol.ts +8 -43
  51. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  52. package/lib/types/core/verification-budget.d.ts +0 -52
  53. package/lib/types/core/verification.d.ts +0 -753
  54. package/lib/types/host/verification-gate.d.ts +0 -95
  55. package/lib/types/host/verification-runner.d.ts +0 -139
  56. package/lib/types/host/workspace-evidence.d.ts +0 -53
  57. package/src/client/board/VerificationReport.tsx +0 -361
  58. package/src/core/verification-budget.ts +0 -115
  59. package/src/core/verification.ts +0 -1594
  60. package/src/host/verification-gate.ts +0 -487
  61. package/src/host/verification-runner.ts +0 -702
  62. package/src/host/workspace-evidence.ts +0 -176
@@ -16,7 +16,7 @@ import type { CardDefaults } from './core/card-defaults.ts'
16
16
  import { TaskBoardExtensionRegistry } from './host/extension-registry.ts'
17
17
  import type { TaskBoardExtension } from './core/extension.ts'
18
18
  import { isTaskPermission, normalizeTargetId, type ExecutionOutcome, type ExecutionSummary, type ScheduleMode, type TaskRecord, type TaskStatus } from './core/tasks.ts'
19
- import { passedAttempt, resolveContract, verificationNeverInvoked, verificationOnlyInvalid, verificationRequired, withAcceptanceDetailCleared, type ExecutionVerification, type ModelCatalogView, type VerificationContract, type VerificationSettings } from './core/verification.ts'
19
+ import type { ModelCatalogView } from './core/model-catalog.ts'
20
20
  import type { TaskPermission } from './core/handover.ts'
21
21
  import type { TaskAttachment } from './core/attachment.ts'
22
22
  import {
@@ -65,50 +65,22 @@ const ABANDONED_LAUNCH_REASON = 'host stopped before this execution started'
65
65
  const REWORK_SESSION_REASON = 'rework: the card\'s previous execution session is not present and idle in the host session roster, so there is no conversation to send the rework instructions into'
66
66
 
67
67
  /**
68
- * The acceptance contract one run group freezes, read once for the whole group.
68
+ * The host model catalog one run group freezes, read once for the whole group.
69
69
  *
70
- * The board freezes an execution's acceptance contract BEFORE its session is
71
- * prompted. Admission delays the launch, so reading these per execution would
72
- * let a settings edit made while later members wait reach some members of one
73
- * run and not others. Reading them once per run group — at the group's first
74
- * admission, which is its root's — keeps the whole group on one contract and
75
- * still freezes it before any member's session is prompted.
70
+ * The catalog decides whether a card's pinned reasoning level may be sent, and
71
+ * it is read BEFORE the session is prompted. Admission delays the launch, so
72
+ * reading it per execution would let a catalog change made while later members
73
+ * wait reach some members of one run and not others. Reading it once per run
74
+ * group — at the group's first admission, which is its root's — keeps the whole
75
+ * group on one catalog and still freezes it before any member is prompted.
76
76
  */
77
- interface FrozenRunContract {
78
- settings: VerificationSettings
79
- /** The GLOBAL native-/goal switch, resolved exactly once for the run group. */
80
- globalGoalEnabled: boolean
81
- /** The host model catalog the group's contracts resolve their route from. */
77
+ interface FrozenRunCatalog {
78
+ /** The host model catalog the group's routes and reasoning levels resolve against. */
82
79
  catalog: ModelCatalogView | undefined
83
80
  }
84
81
 
85
- /** Reads (or returns the already-read) contract of one run group. */
86
- type RunContractFreezer = () => Promise<FrozenRunContract>
87
-
88
- /**
89
- * Why an enforced goal execution settled failed while its acceptance DID run:
90
- * attempts were recorded and none of them passed. The judge answered about the
91
- * work and the work did not pass.
92
- */
93
- export const NO_MATCHING_PASS_VERIFICATION_REASON = 'goal 验收:本次执行没有匹配的验收通过记录(验收未运行、未通过或报告来自其他执行),按未验收判失败。'
94
- /**
95
- * Why an enforced goal execution settled failed with ZERO acceptance records:
96
- * the gate was never opened, so the judge never ran and nothing was ever judged
97
- * (issue #1837). The root cause is a session that declared completion in prose
98
- * instead of calling `update_goal(action: complete)` — a tool-adherence problem,
99
- * NOT a quality verdict on the delivery — so this reason says so and keeps the
100
- * two investigation directions apart.
101
- */
102
- export const NEVER_INVOKED_VERIFICATION_REASON = 'goal 验收未触发:本次执行没有任何验收记录,验收门从未打开——执行会话没有调用 update_goal(action: complete) 来完成目标(常见于只在回复里宣告完成)。这不是质量判负:交付从未被裁判评估。'
103
- /**
104
- * Why an enforced goal execution settled failed while its ONLY acceptance
105
- * records are INVALID: the judge answered but could not locate its own
106
- * rejection, so the board stopped calling it. This is NOT an evidence-backed
107
- * quality veto — the requirement is explicit that such a run must not be
108
- * described as one — but the execution still has no matching pass, so it ends
109
- * for lack of one, and the reason names that precisely.
110
- */
111
- export const INVALID_ONLY_VERIFICATION_REASON = 'goal 验收无效:本次执行只记录了无效验收(裁判未能给出与任务要求对应、且可定位到本次证据的否决依据),看板已停止调用裁判。这**不是**有证据的质量判负:验收本身不可用,本次运行因没有匹配的通过记录而结束。请检查验收环境与证据可见性,或用 task_board_manage(action=reset-verification) 清除记录的无效验收后重新完成目标。'
82
+ /** Reads (or returns the already-read) catalog of one run group. */
83
+ type RunCatalogFreezer = () => Promise<FrozenRunCatalog>
112
84
 
113
85
  /**
114
86
  * Provenance of one cron-triggered run: when the rule fired and the zone
@@ -134,7 +106,7 @@ export interface ScheduledRunContext {
134
106
  * an enabled rule (the new-task dialog and the one-time browser import),
135
107
  * `set-schedule` edits one, and `delete`/`archive` drop one. `update` is
136
108
  * deliberately absent — the update patch cannot carry a schedule — and neither
137
- * can the run, move, lineage, permission, verification or label actions.
109
+ * can the run, move, lineage, permission or label actions.
138
110
  */
139
111
  const SCHEDULE_WRITE_ACTIONS: ReadonlySet<TaskBoardAction['kind']> = new Set(['create', 'import', 'set-schedule', 'delete', 'archive'])
140
112
 
@@ -205,7 +177,6 @@ const ACTION_KINDS: Readonly<Record<TaskBoardAction['kind'], true>> = {
205
177
  archive: true,
206
178
  restore: true,
207
179
  settle: true,
208
- 'reset-verification': true,
209
180
  'record-external-outcome': true,
210
181
  'set-schedule': true,
211
182
  run: true,
@@ -265,11 +236,9 @@ export class TaskBoardHostService {
265
236
  */
266
237
  private readonly unreadablePolls = new Map<string, number>()
267
238
  private preventIdleSleep = false
268
- private readonly verificationSettings: () => VerificationSettings
269
- private readonly verificationCatalog: () => Promise<ModelCatalogView | undefined>
239
+ /** Live reader of the host model catalog; frozen per run group. */
240
+ private readonly modelCatalog: () => Promise<ModelCatalogView | undefined>
270
241
  private readonly timers: HostTimerFace
271
- /** Live reader of the global native-/goal switch; frozen per execution. */
272
- private readonly goalRunEnabled: () => boolean
273
242
  /** Live reader of the deployment's new-card defaults (published and applied per create). */
274
243
  private readonly cardDefaults: () => CardDefaults
275
244
  /**
@@ -324,21 +293,12 @@ export class TaskBoardHostService {
324
293
  cardDefaults?: () => CardDefaults
325
294
  timers?: HostTimerFace
326
295
  /**
327
- * Live GLOBAL native /goal switch (a volatile config read). Read ONCE per
328
- * execution, at launch, and carried by value from then on: a settings edit
329
- * made while a run is in flight must not arm, disarm or otherwise change the
330
- * goal/acceptance contract of that run. Absent means OFF, which is the
331
- * default for every deployment that never configured it.
332
- */
333
- goalRunEnabled?: () => boolean
334
- /**
335
- * Live acceptance settings (volatile config reads). Absent keeps goal
336
- * acceptance OFF for every execution this service opens, which is what a
337
- * programmatic mount without the settings domain gets.
296
+ * The host model catalog the card routes and reasoning levels resolve
297
+ * against, read live so a deployment that mounts the model service after the
298
+ * board still gains it. Absent means "no capability evidence": a pinned
299
+ * effort is then not sent at all.
338
300
  */
339
- verificationSettings?: () => VerificationSettings
340
- /** The host model catalog the acceptance contract resolves its route from. */
341
- verificationCatalog?: () => Promise<ModelCatalogView | undefined>
301
+ modelCatalog?: () => Promise<ModelCatalogView | undefined>
342
302
  /**
343
303
  * Live admission width for run launches: the number of launches (one
344
304
  * session creation and its prompt each) that may be in flight at once. Read
@@ -370,6 +330,14 @@ export class TaskBoardHostService {
370
330
  * unknown is allowed.
371
331
  */
372
332
  modelInfo?: () => ModelInfoResolver | undefined
333
+ /**
334
+ * Whether this deployment runs the legacy Agent Teams runtime. Read at
335
+ * launch, only for a run the board is about to force under the dispatcher
336
+ * preset: such a deployment cannot orchestrate, so the run fails closed on
337
+ * the card instead of deadlocking in a session nobody answers (issue #2031).
338
+ * Absent means "not proven legacy", which keeps the force exactly as it is.
339
+ */
340
+ legacyAgentTeams?: () => boolean
373
341
  } = {}) {
374
342
  this.ledger = options.ledger ?? new HostTaskLedger(undefined, undefined, {
375
343
  sessionDefaultPermission: options.sessionDefaultPermission,
@@ -382,19 +350,18 @@ export class TaskBoardHostService {
382
350
  this.runner = new HostExecutionRunner(gateway, options.commandDispatcher, options.workspaceRegistry, undefined, options.ownerPeer, {
383
351
  attachments: this.attachmentStore,
384
352
  llm: options.modelInfo,
353
+ ...(options.legacyAgentTeams === undefined ? {} : { legacyAgentTeams: options.legacyAgentTeams }),
385
354
  })
386
355
  this.workspaceRegistry = options.workspaceRegistry
387
356
  this.timers = options.timers ?? PROCESS_TIMERS
388
357
  this.power = options.power ?? new PowerInhibitor()
389
358
  this.now = options.now ?? Date.now
390
- this.goalRunEnabled = options.goalRunEnabled ?? (() => false)
391
359
  this.cardDefaults = options.cardDefaults ?? (() => ({}))
392
360
  this.runLaunchWidth = options.runLaunchWidth ?? (() => DEFAULT_RUN_LAUNCH_WIDTH)
393
361
  this.spendBudgetTokens = options.spendBudgetTokens ?? (() => DEFAULT_SPEND_BUDGET_TOKENS)
394
362
  this.spendUsedToday = options.spendUsedToday ?? (now => usedTokensToday(now))
395
363
  this.launches = new LaunchAdmissionQueue(() => normalizeRunLaunchWidth(this.runLaunchWidth()))
396
- this.verificationSettings = options.verificationSettings ?? (() => ({ enabled: false, model: '', reasoningEffort: '' }))
397
- this.verificationCatalog = options.verificationCatalog ?? (async () => undefined)
364
+ this.modelCatalog = options.modelCatalog ?? (async () => undefined)
398
365
  this.extensions = new TaskBoardExtensionRegistry({
399
366
  ledger: this.ledger,
400
367
  // Capability writes go through the board's own action path, so every
@@ -432,9 +399,6 @@ export class TaskBoardHostService {
432
399
  this.syncPowerReasons()
433
400
  this.pollTimer = this.timers.interval(() => { this.schedulePoll() }, sessionPollMs(this.sessionPollSeconds))
434
401
  this.schedulePoll()
435
- // Boot is also the cleanup catch-up point: an execution that passed before
436
- // the Host stopped may still hold its detail (a crash, a failed write).
437
- this.cleanupPendingAcceptanceDetail()
438
402
  // Boot is a recovery point: an occurrence armed while the Host was down is
439
403
  // not replayed, and each schedule rolls to its next future target. A
440
404
  // schedule the Board should have served while running is then armed
@@ -510,13 +474,9 @@ export class TaskBoardHostService {
510
474
  power: this.power.snapshot(),
511
475
  sessionDefaultPermission: this.ledger.sessionDefaultPermission,
512
476
  maxSubtaskDepth: this.ledger.maxSubtaskDepth,
513
- // The GLOBAL native-/goal switch is published live for the UI, but the
514
- // service freezes its own read at launch: this mirror is for the FORM
515
- // (enable/disable + explanation), never for a run already in flight.
516
- goalRunEnabled: this.goalRunEnabled(),
517
- // The new-card defaults are published live for the same reason the switch
518
- // is: the create dialog prefills from them, and each creating session
519
- // re-reads them for the create it submits.
477
+ // The new-card defaults are published live: the create dialog prefills
478
+ // from them, and each creating session re-reads them for the create it
479
+ // submits.
520
480
  ...(cardDefaults === undefined ? {} : { cardDefaults }),
521
481
  // The attachment limits travel with the snapshot so the browser can
522
482
  // refuse an oversized selection before it uploads anything.
@@ -534,26 +494,13 @@ export class TaskBoardHostService {
534
494
  }
535
495
 
536
496
  /**
537
- * The acceptance configuration the settings card displays: the live settings,
538
- * the contract they resolve to, and the host catalog the choices come from.
539
- *
540
- * The card shows the RESOLVED route, not the raw configuration, so "inherit
541
- * host" reads as the concrete model and reasoning level the next execution
542
- * will actually freeze, including any recorded effort fallback.
543
- * @returns the resolved acceptance options.
497
+ * The host model catalog the settings card's model and reasoning-level
498
+ * choices come from.
499
+ * @returns the catalog, or an empty one when this deployment serves none.
544
500
  */
545
- async verificationOptions(): Promise<{
546
- settings: VerificationSettings
547
- contract: VerificationContract
548
- catalog: ModelCatalogView
549
- }> {
550
- const settings = this.verificationSettings()
551
- const catalog = await this.verificationCatalog()
552
- return {
553
- settings,
554
- contract: resolveContract(settings, catalog),
555
- catalog: catalog ?? { groups: [] },
556
- }
501
+ async modelCatalogOptions(): Promise<{ catalog: ModelCatalogView }> {
502
+ const catalog = await this.modelCatalog()
503
+ return { catalog: catalog ?? { groups: [] } }
557
504
  }
558
505
 
559
506
  /** SSE frame payload; deliberately skips the tasks deep-clone of {@link snapshot}. */
@@ -761,7 +708,7 @@ export class TaskBoardHostService {
761
708
  this.listeners.clear()
762
709
  }
763
710
 
764
- private async launch(opened: OpenedRun, schedule?: ScheduledRunContext, freezeContract?: RunContractFreezer): Promise<void> {
711
+ private async launch(opened: OpenedRun, schedule?: ScheduledRunContext, freezeCatalog?: RunCatalogFreezer): Promise<void> {
765
712
  /** The session this launch attached to the execution, once it exists. */
766
713
  let attached: string | undefined
767
714
  try {
@@ -801,65 +748,27 @@ export class TaskBoardHostService {
801
748
  ...(rework === undefined ? {} : { rework }),
802
749
  }
803
750
  const promptContext = Object.keys(contextParts).length === 0 ? undefined : contextParts
804
- // Freeze this execution's acceptance contract BEFORE the session is
805
- // prompted: a settings change made while the run is in flight must not
806
- // retrofit the rule that will judge it. A card that opted out resolves the
807
- // same contract from an OFF switch: the board-wide switch decides the
808
- // default, the card decides this execution, and both are read here.
751
+ // Freeze this run group's model catalog BEFORE the session is prompted: a
752
+ // catalog change made while the run is in flight must not change which
753
+ // reasoning level this execution is allowed to send.
809
754
  //
810
755
  // The read is the run GROUP's when the queue handed one down: admission
811
- // delays a member's launch, so a per-execution read would let a settings
812
- // edit made while later members wait reach some members of one run and not
813
- // others. One group, one contract — and still frozen before the group's
756
+ // delays a member's launch, so a per-execution read would let a change
757
+ // made while later members wait reach some members of one run and not
758
+ // others. One group, one catalog — and still frozen before the group's
814
759
  // first session is prompted.
815
- const { settings, globalGoalEnabled, catalog } = await (freezeContract ?? (() => this.freezeRunContract()))()
816
- // The GLOBAL native-/goal switch is read ONCE per run group and carried by
817
- // value for the whole execution: a settings edit after this point can only
818
- // affect executions that start later.
819
- // The card must ASK for the goal run: the option is off by default, so an
820
- // absent value is a plain turn exactly like an explicit false.
821
- const goalEnabled = globalGoalEnabled && opened.task.goalRun === true
822
- // The card's opt-out is a DISTINCT reason, not the board switch: the
823
- // report must be able to say which of the two turned the gate off.
824
- const skippedBy: ExecutionVerification['applicability'] = opened.task.skipVerification === true ? 'skipped' : 'disabled'
825
- const contract = resolveContract(
826
- { ...settings, enabled: settings.enabled && opened.task.skipVerification !== true },
827
- catalog,
828
- )
829
- // An execution that will not become a goal run can never fire the
830
- // completion gate, so it is marked with the reason that actually applied:
831
- // the global switch being off is its OWN reason, distinct from this run
832
- // simply not becoming a goal run (the card never opted in, or a refused or
833
- // unavailable /goal command), and it must never read as an accepted run.
834
- // The reason names which switch withheld the goal: the GLOBAL master
835
- // switch (this board never arms /goal) is a different fact from the card's
836
- // own goal option staying off — which is the default, so it is what an
837
- // untouched card gets.
838
- const notArmed: ExecutionVerification['applicability'] = globalGoalEnabled ? 'goal-unavailable' : 'goal-disabled'
839
- const initial: ExecutionVerification = {
840
- contract,
841
- attempts: [],
842
- applicability: !contract.enabled ? skippedBy : notArmed,
843
- }
844
- this.ledger.setVerification(opened.task.id, opened.execution.id, initial)
760
+ const { catalog } = await (freezeCatalog ?? (() => this.readRunCatalog()))()
845
761
  const sessionId = await this.runner.launch(opened.task, {
846
762
  ...(reuseSessionId === undefined ? {} : { reuseSessionId }),
847
763
  ...(forcedPreset === undefined ? {} : { agentPreset: forcedPreset }),
848
764
  ...(promptContext === undefined ? {} : { promptContext }),
849
- // The frozen global switch travels with the launch, so the runner's
850
- // arming decision is exactly the one made above.
851
- goalEnabled,
852
- // The same catalog snapshot the acceptance contract was frozen from.
765
+ // The same catalog snapshot the reasoning decision is resolved from.
853
766
  catalog,
854
- // Bind the session to the execution before the prompt is queued, so the
855
- // completion gate can never observe the agent without its binding.
767
+ // Bind the session to the execution before the prompt is queued.
856
768
  onSession: (id) => {
857
769
  attached = id
858
770
  this.ledger.attachSession(opened.task.id, opened.execution.id, id)
859
771
  },
860
- onGoalArmed: (armed) => {
861
- this.setApplicability(opened.task.id, opened.execution.id, !contract.enabled ? skippedBy : armed ? 'enforced' : notArmed)
862
- },
863
772
  })
864
773
  if (attached === undefined) this.ledger.attachSession(opened.task.id, opened.execution.id, sessionId)
865
774
  } catch (error) {
@@ -879,27 +788,22 @@ export class TaskBoardHostService {
879
788
  }
880
789
 
881
790
  /**
882
- * Read the acceptance contract one run group freezes, in the order the board
883
- * has always read it: the acceptance settings, then the global native-/goal
884
- * switch, then the model catalog that both resolves the contract's route and
885
- * decides the reasoning effort the session may be given.
791
+ * Read the model catalog one run group freezes. The catalog is what decides
792
+ * whether a card's pinned reasoning level may be sent to the session.
886
793
  */
887
- private async freezeRunContract(): Promise<FrozenRunContract> {
888
- const settings = this.verificationSettings()
889
- const globalGoalEnabled = this.goalRunEnabled() === true
890
- const catalog = await this.verificationCatalog()
891
- return { settings, globalGoalEnabled, catalog }
794
+ private async readRunCatalog(): Promise<FrozenRunCatalog> {
795
+ return { catalog: await this.modelCatalog() }
892
796
  }
893
797
 
894
798
  /**
895
- * A {@link RunContractFreezer} that reads once and hands the SAME value to
799
+ * A {@link RunCatalogFreezer} that reads once and hands the SAME value to
896
800
  * every later caller of one run group. A read that fails is not cached: the
897
801
  * next member reads again, exactly as a per-execution read would have.
898
802
  */
899
- private contractFreezerForRunGroup(): RunContractFreezer {
900
- let pending: Promise<FrozenRunContract> | undefined
803
+ private catalogFreezerForRunGroup(): RunCatalogFreezer {
804
+ let pending: Promise<FrozenRunCatalog> | undefined
901
805
  return () => {
902
- pending ??= this.freezeRunContract().catch((error: unknown) => {
806
+ pending ??= this.readRunCatalog().catch((error: unknown) => {
903
807
  pending = undefined
904
808
  throw error
905
809
  })
@@ -1038,16 +942,6 @@ export class TaskBoardHostService {
1038
942
  ): Promise<void> {
1039
943
  for (const execution of executions) {
1040
944
  if (execution.sessionId === undefined) continue
1041
- const record = this.ledger.getTask(execution.taskId)?.executions.find(entry => entry.id === execution.executionId)
1042
- const verification = record?.verification
1043
- // A cycle the gate already closed is decided here, without another
1044
- // inspection: the goal may still be active (or un-blockable) exactly
1045
- // because the acceptance failed, and the card must not stay in the
1046
- // running column waiting for a verdict that is already recorded.
1047
- if (verification?.failedReason !== undefined) {
1048
- this.settleAndNotify(execution.taskId, execution.executionId, 'failed', verification.failedReason)
1049
- continue
1050
- }
1051
945
  try {
1052
946
  // A team member's turn is read even while the roster calls its session
1053
947
  // running: a durable teammate never goes idle for good.
@@ -1060,29 +954,6 @@ export class TaskBoardHostService {
1060
954
  continue
1061
955
  }
1062
956
  this.unreadablePolls.delete(execution.executionId)
1063
- // Forced acceptance: the old fallback paths — a completed turn, a
1064
- // paused goal, an unreadable projection, a manual settle — must never
1065
- // be mistaken for a verified success. Only a matching pass record
1066
- // settles this execution as succeeded.
1067
- if (result.outcome === 'succeeded' && verificationRequired(verification) && passedAttempt(verification) === undefined) {
1068
- // Two different failures share this branch, and they send the reader
1069
- // in opposite directions: attempts on record mean the judge ran and
1070
- // the work did not pass, while zero attempts mean the gate never
1071
- // opened at all (issue #1837) — the session narrated completion
1072
- // instead of calling `update_goal(action: complete)`.
1073
- this.settleAndNotify(
1074
- execution.taskId,
1075
- execution.executionId,
1076
- 'failed',
1077
- verificationNeverInvoked(verification)
1078
- ? NEVER_INVOKED_VERIFICATION_REASON
1079
- : verificationOnlyInvalid(verification)
1080
- ? INVALID_ONLY_VERIFICATION_REASON
1081
- : NO_MATCHING_PASS_VERIFICATION_REASON,
1082
- result.summary,
1083
- )
1084
- continue
1085
- }
1086
957
  // The run's closing text rides whichever verdict it earned: a failed
1087
958
  // execution still leaves what it managed to say.
1088
959
  this.settleAndNotify(execution.taskId, execution.executionId, result.outcome, 'error' in result ? result.error : undefined, result.summary)
@@ -1125,73 +996,6 @@ export class TaskBoardHostService {
1125
996
  outcome,
1126
997
  ...(error === undefined ? {} : { error }),
1127
998
  })
1128
- // The pass record and the settlement are DURABLE by this point (both are in
1129
- // the ledger above), so the acceptance-only detail may now be cleaned. A
1130
- // cleanup failure is recorded against the execution and retried on the next
1131
- // Host start; it never revokes the pass this settlement just wrote.
1132
- if (outcome === 'succeeded') this.cleanupAcceptanceDetail(taskId, executionId)
1133
- }
1134
-
1135
- /**
1136
- * Remove one execution's acceptance-only detail after it PASSED and settled.
1137
- *
1138
- * Deliberately narrow: only the acceptance mechanism's own per-attempt
1139
- * material (findings, invalid diagnostics, the bulky judge side) is removed,
1140
- * and only for THIS execution, keyed by its own id in the ledger it belongs
1141
- * to. No user file, task artifact, raw session history or other execution's
1142
- * record is read or written. Idempotent by the record's own state, and it
1143
- * clearly never touches a run that did not pass (the caller's guard) — a
1144
- * failed or invalid execution keeps everything a repair or a review needs.
1145
- * @param taskId - the task whose execution settled.
1146
- * @param executionId - the settled execution.
1147
- */
1148
- private cleanupAcceptanceDetail(taskId: string, executionId: string): void {
1149
- const execution = this.ledger.getTask(taskId)?.executions.find(entry => entry.id === executionId)
1150
- const verification = execution?.verification
1151
- // Only an execution with a REAL pass record is cleaned. An execution whose
1152
- // acceptance never ran (no block) or was disabled/skipped has nothing this
1153
- // mechanism created, and a failed one must keep its evidence.
1154
- if (verification === undefined || passedAttempt(verification) === undefined) return
1155
- if (verification.cleanup?.state === 'cleaned') return
1156
- try {
1157
- const cleaned = withAcceptanceDetailCleared(verification, this.now())
1158
- if (cleaned === undefined) return
1159
- this.ledger.setVerification(taskId, executionId, cleaned)
1160
- } catch (error) {
1161
- // Record the failure so the UI can say the cleanup is pending and the
1162
- // Host retries it at start; the pass itself is untouched.
1163
- const attempts = (verification.cleanup?.attempts ?? 0) + 1
1164
- this.ledger.setVerification(taskId, executionId, {
1165
- ...verification,
1166
- cleanup: {
1167
- state: 'failed',
1168
- attempts,
1169
- startedAt: verification.cleanup?.startedAt ?? this.now(),
1170
- lastError: error instanceof Error ? error.message : String(error),
1171
- audit: verification.cleanup?.audit ?? [],
1172
- },
1173
- })
1174
- safeConsoleError('[dsh-task-board] acceptance-detail cleanup failed; it is retried on the next Host start', error)
1175
- }
1176
- }
1177
-
1178
- /**
1179
- * Catch-up pass: clean the acceptance detail of every execution that PASSED
1180
- * and settled but whose cleanup did not finish (a crash, a failed write, a
1181
- * Host killed mid-cleanup).
1182
- *
1183
- * The same bounds as any other cleanup apply — only a real pass record on a
1184
- * settled execution is touched — so this can never delete material belonging
1185
- * to an execution that did not pass, and never a user file.
1186
- */
1187
- private cleanupPendingAcceptanceDetail(): void {
1188
- for (const task of this.ledger.allTasks()) {
1189
- for (const execution of task.executions) {
1190
- if (execution.endedAt === undefined) continue
1191
- if (execution.result !== 'succeeded') continue
1192
- this.cleanupAcceptanceDetail(task.id, execution.id)
1193
- }
1194
- }
1195
999
  }
1196
1000
 
1197
1001
  private noteUnreadableInspection(execution: OpenExecutionReference, reason: string | undefined): void {
@@ -1307,21 +1111,11 @@ export class TaskBoardHostService {
1307
1111
  private dispatchRuns(runs: readonly OpenedRun[], schedule?: ScheduledRunContext): void {
1308
1112
  const root = runs[0]
1309
1113
  if (root === undefined) return
1310
- this.scheduleLaunch(root, schedule, this.contractFreezerForRunGroup())
1311
- }
1312
-
1313
- /**
1314
- * Move one execution's applicability without touching its frozen contract or
1315
- * its recorded attempts (used when the run's goal form becomes known).
1316
- */
1317
- private setApplicability(taskId: string, executionId: string, applicability: ExecutionVerification['applicability']): void {
1318
- const verification = this.ledger.getTask(taskId)?.executions.find(entry => entry.id === executionId)?.verification
1319
- if (verification === undefined || verification.applicability === applicability) return
1320
- this.ledger.setVerification(taskId, executionId, { ...verification, applicability })
1114
+ this.scheduleLaunch(root, schedule, this.catalogFreezerForRunGroup())
1321
1115
  }
1322
1116
 
1323
- private scheduleLaunch(opened: OpenedRun, schedule?: ScheduledRunContext, freezeContract?: RunContractFreezer): void {
1324
- this.enqueueLaunch(opened, () => this.launch(opened, schedule, freezeContract).catch(error => {
1117
+ private scheduleLaunch(opened: OpenedRun, schedule?: ScheduledRunContext, freezeCatalog?: RunCatalogFreezer): void {
1118
+ this.enqueueLaunch(opened, () => this.launch(opened, schedule, freezeCatalog).catch(error => {
1325
1119
  safeConsoleError('[dsh-task-board] execution launch settlement failed', error)
1326
1120
  }), schedule)
1327
1121
  }