Skip to content

Commit c98ea00

Browse files
committed
feat: add notification-threshold apply reconciliation
1 parent 7e0c7f7 commit c98ea00

8 files changed

Lines changed: 533 additions & 44 deletions

docs/brainstorms/2026-04-16-mainline-ci-stabilization-and-m7-direction-requirements.md

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ Suggested verification slice:
848848
- Best next increment is not broader remediation scope.
849849
Best next increment is a narrow apply-outcome reconciliation surface on top of existing audit artifacts.
850850

851-
### M7.25 (Next): Notification-Threshold Apply Outcome Reconciliation (Lane Ops Bridge)
851+
### M7.25 (Now): Notification-Threshold Apply Outcome Reconciliation (Lane Ops Bridge)
852852

853853
Deliverables:
854854

@@ -864,6 +864,69 @@ Suggested verification slice:
864864
- `npm run docs:diataxis:check`
865865
- `npm run docs:site:build`
866866

867+
#### M7.25 Progress Note (2026-04-16)
868+
869+
- [Done] expanded `src/server.ts` with explicit reconciliation route:
870+
- `GET /api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/reconciliation`.
871+
- [Done] added file-backed latest-apply outcome persistence:
872+
- `runtime_data/agent_workspace_diagnostics/triage_remediation_escalation_notification_threshold_apply_outcome.v1.json`.
873+
- [Done] added deterministic reconciliation helper stack:
874+
- `readAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`,
875+
- `writeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`,
876+
- `buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcomeReconciliation(...)`.
877+
- [Done] apply execution now persists reconciliation evidence:
878+
- latest `previewFingerprint`,
879+
- applied mode,
880+
- applied audit id / changedAt,
881+
- source / reason,
882+
- applied threshold snapshot.
883+
- [Done] reconciliation payload now surfaces bounded readback state:
884+
- `latestApplyOutcome`,
885+
- `currentActiveThresholds`,
886+
- `latestAuditEntry`,
887+
- `reconciliation.status`,
888+
- `reconciliation.latestAuditMatchesApply`,
889+
- `reconciliation.activeThresholdsMatchApply`,
890+
- `reconciliation.driftReasons`.
891+
- [Done] drift semantics are now explicit and deterministic:
892+
- no outcome file returns bounded `no-apply-outcome`,
893+
- superseding audits mark the latest apply outcome as drifted,
894+
- active threshold divergence is reported independently of audit supersession.
895+
- [Done] expanded evidence coverage:
896+
- `src/server.migration.test.ts` now validates reconciliation success immediately after apply, persisted apply-outcome file contents, and drift detection after a later threshold override.
897+
- `src/knowledge.api.contract.test.ts`, `src/agent_workspace.verification.contract.test.ts`, and `scripts/verify-agent-workspace-runtime.js` now fail fast on reconciliation-route and apply-outcome helper drift.
898+
- [Done] verification evidence:
899+
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern "notification threshold apply outcome reconciliation stays deterministic"`
900+
- `npm run test:agent-workspace:contracts`
901+
- `npm run verify:agent-workspace:runtime`
902+
- `npm run docs:diataxis:check`
903+
- `npm run docs:site:build`
904+
905+
### Post-M7.25 Architecture Judgment
906+
907+
- L5 governance now covers preview, guarded apply, and latest-outcome reconciliation for notification-threshold mutations.
908+
- Current weak point shifts from latest-outcome truthiness to bounded operator handoff:
909+
- operators can now tell whether the most recent applied preview is still current,
910+
- operators still cannot inspect a compact history of earlier apply outcomes once the latest one is superseded.
911+
- Best next increment is not broader remediation expansion.
912+
Best next increment is a narrow history surface for apply outcomes and their reconciliation statuses.
913+
914+
### M7.26 (Next): Notification-Threshold Apply Outcome History Surface (Lane Ops Bridge)
915+
916+
Deliverables:
917+
918+
- add bounded history surface for recent notification-threshold apply outcomes.
919+
- include per-entry apply metadata plus latest reconciliation status so operator handoff does not depend on a single latest record.
920+
- keep scope limited to notification-threshold governance; do not reopen UI, unrelated remediation lanes, or retrieval/memory work.
921+
922+
Suggested verification slice:
923+
924+
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern "notification threshold apply outcome history"`
925+
- `npm run test:agent-workspace:contracts`
926+
- `npm run verify:agent-workspace:runtime`
927+
- `npm run docs:diataxis:check`
928+
- `npm run docs:site:build`
929+
867930
## Success Criteria
868931

869932
- CI failure mode that previously blocked the three agent-workspace suites is eliminated on mainline.
@@ -873,4 +936,4 @@ Suggested verification slice:
873936

874937
## Next Step
875938

876-
Proceed to `/prompts:ce-plan` using this document as the source for `M7.25` decomposition (notification-threshold apply outcome reconciliation), while preserving M7 lane boundary constraints.
939+
Proceed to `/prompts:ce-plan` using this document as the source for `M7.26` decomposition (notification-threshold apply outcome history surface), while preserving M7 lane boundary constraints.

docs/diataxis/en/explanation/development-progress-dashboard.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -599,32 +599,34 @@ Execution anchor:
599599
- `npm run test:agent-workspace:contracts`
600600
- `npm run verify:agent-workspace:runtime`
601601

602-
## Latest Mainline Increment (2026-04-16 M7.24 Notification-Threshold Rollback Apply Guardrails Lane)
603-
604-
- Expanded `src/server.ts` with explicit apply route:
605-
- `POST /api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/apply`.
606-
- Added deterministic preview-to-apply helper stack:
607-
- `buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreviewFingerprint(...)`,
608-
- `applyAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreview(...)`,
609-
- `normalizeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreviewMode(...)`.
610-
- Hardened mutation safety without widening scope:
611-
- preview payloads now expose `preview.resetToDefault.previewFingerprint` and `preview.rollbackToPrevious.previewFingerprint`,
612-
- apply requests must match the reviewed fingerprint,
613-
- rollback-to-previous apply requests must also match the reviewed `auditId`,
614-
- stale fingerprints, unavailable rollback previews, mismatched audit ids, and no-op targets are rejected deterministically.
615-
- Added bounded execution receipts:
616-
- apply responses now return `appliedMode`, `previewFingerprint`, `matchedPreview`, and `appliedAuditEntry`.
602+
## Latest Mainline Increment (2026-04-16 M7.25 Notification-Threshold Apply Outcome Reconciliation Lane)
603+
604+
- Expanded `src/server.ts` with explicit reconciliation route:
605+
- `GET /api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/reconciliation`.
606+
- Added file-backed latest-apply outcome persistence:
607+
- `runtime_data/agent_workspace_diagnostics/triage_remediation_escalation_notification_threshold_apply_outcome.v1.json`.
608+
- Added deterministic reconciliation helper stack:
609+
- `readAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`,
610+
- `writeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`,
611+
- `buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcomeReconciliation(...)`.
612+
- Hardened operator readback without widening scope:
613+
- apply execution now persists latest preview fingerprint, applied mode, audit id/changedAt, source/reason, and applied threshold snapshot,
614+
- reconciliation payload now exposes `latestApplyOutcome`, `currentActiveThresholds`, `latestAuditEntry`, and bounded drift booleans/reasons.
615+
- Added deterministic reconciliation semantics:
616+
- no apply outcome yields bounded `no-apply-outcome`,
617+
- superseding audit entries mark the last apply outcome as drifted,
618+
- active threshold divergence is reported independently from audit supersession.
617619
- Expanded executable evidence:
618-
- `src/server.migration.test.ts` now validates audit-id mismatch blocking, stale fingerprint blocking, rollback apply success, reset apply success, and persisted audit ordering.
620+
- `src/server.migration.test.ts` now validates immediate post-apply reconciliation, persisted apply-outcome file contents, and drift detection after a later override.
619621
- Hardened runtime verification gate:
620-
- `src/knowledge.api.contract.test.ts`, `src/agent_workspace.verification.contract.test.ts`, and `scripts/verify-agent-workspace-runtime.js` now fail fast on notification-threshold apply route and fingerprint/apply helper drift.
622+
- `src/knowledge.api.contract.test.ts`, `src/agent_workspace.verification.contract.test.ts`, and `scripts/verify-agent-workspace-runtime.js` now fail fast on notification-threshold reconciliation route and apply-outcome helper drift.
621623
- Verification evidence:
622-
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern \"notification threshold rollback apply guardrails stay deterministic\"`
624+
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern \"notification threshold apply outcome reconciliation stays deterministic\"`
623625
- `npm run test:agent-workspace:contracts`
624626
- `npm run verify:agent-workspace:runtime`
625627
- Next direction judgment:
626-
- current bottleneck shifts from guarded execution to post-apply reconciliation,
627-
- M7.25 should stay bounded to apply-outcome reconciliation, not broader remediation or UI expansion.
628+
- current bottleneck shifts from latest-outcome readback to bounded operator handoff/history,
629+
- M7.26 should stay bounded to apply-outcome history, not broader remediation or UI expansion.
628630

629631
## Mainline vs Working-Branch Snapshot (2026-04-14)
630632

@@ -674,7 +676,7 @@ This dashboard aligns against the following requirement chain:
674676
| L2 Retrieval | explainable hybrid/vector retrieval + governance | Expanded in branch-oriented plans | Mainline file-backed baseline only (`src/learning/store.ts`) | Re-enter lane after concrete module evidence lands on mainline |
675677
| L3 Learning | mastery diagnostics + path/session loop | Expanded in branch | Partially integrated | Contract and integration parity |
676678
| L4 Interaction | agent conversation + focus/path pane runtime | Implemented in branch | M1-M4 baseline integrated on mainline | Expand capability surface via typed contract only |
677-
| L5 Governance | runbook, diagnostics, replay/autonomy controls | Expanded in branch | Operator diagnostics persistence/triage/history/threshold governance + runbook automation/audit + adaptive simulation/remediation + remediation backtest/approval-gate + approval-policy hardening/regression-alarms + approval-policy drift/escalation + escalation acknowledgement lifecycle/audit + escalation SLA/reminder baseline + notification digest/suppression baseline + delivery-log observability + stale-cleanup health auditing + anomaly/retention governance + notification SLO governance + notification-threshold override/audit governance + rollback preview/drift-diff governance + rollback apply guardrails integrated | M7.25: notification-threshold apply outcome reconciliation |
679+
| L5 Governance | runbook, diagnostics, replay/autonomy controls | Expanded in branch | Operator diagnostics persistence/triage/history/threshold governance + runbook automation/audit + adaptive simulation/remediation + remediation backtest/approval-gate + approval-policy hardening/regression-alarms + approval-policy drift/escalation + escalation acknowledgement lifecycle/audit + escalation SLA/reminder baseline + notification digest/suppression baseline + delivery-log observability + stale-cleanup health auditing + anomaly/retention governance + notification SLO governance + notification-threshold override/audit governance + rollback preview/drift-diff governance + rollback apply guardrails + latest apply-outcome reconciliation integrated | M7.26: notification-threshold apply outcome history surface |
678680

679681
## Verification Baseline
680682

docs/diataxis/zh/explanation/development-progress-dashboard.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -601,32 +601,34 @@
601601
- `npm run test:agent-workspace:contracts`
602602
- `npm run verify:agent-workspace:runtime`
603603

604-
## 主线最新增量(2026-04-16 M7.24 通知阈值回滚 apply guardrails 链路)
605-
606-
- 已在 `src/server.ts` 增加显式 apply 路由:
607-
- `POST /api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/apply`
608-
- 已增加确定性 preview-to-apply helper 栈:
609-
- `buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreviewFingerprint(...)`
610-
- `applyAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreview(...)`
611-
- `normalizeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreviewMode(...)`
612-
- 已在不扩 scope 前提下加固 mutation 安全:
613-
- 预览载荷现在输出 `preview.resetToDefault.previewFingerprint``preview.rollbackToPrevious.previewFingerprint`
614-
- apply 请求必须匹配已审阅的 preview fingerprint,
615-
- rollback-to-previous apply 请求还必须匹配已审阅的 `auditId`
616-
- stale fingerprint、不可用 rollback preview、auditId 不匹配与 no-op target 都会被确定性拒绝。
617-
- 已增加有界执行回执:
618-
- apply 响应现在返回 `appliedMode``previewFingerprint``matchedPreview``appliedAuditEntry`
604+
## 主线最新增量(2026-04-16 M7.25 通知阈值 apply 结果对账链路)
605+
606+
- 已在 `src/server.ts` 增加显式 reconciliation 路由:
607+
- `GET /api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/reconciliation`
608+
- 已增加 file-backed latest-apply outcome 持久化:
609+
- `runtime_data/agent_workspace_diagnostics/triage_remediation_escalation_notification_threshold_apply_outcome.v1.json`
610+
- 已增加确定性 reconciliation helper 栈:
611+
- `readAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`
612+
- `writeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome(...)`
613+
- `buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcomeReconciliation(...)`
614+
- 已在不扩 scope 前提下补足 operator readback:
615+
- apply 执行现在持久化 latest preview fingerprint、applied mode、audit id/changedAt、source/reason 与 applied threshold snapshot,
616+
- reconciliation 载荷现在输出 `latestApplyOutcome``currentActiveThresholds``latestAuditEntry` 与有界 drift 布尔量/原因。
617+
- 已增加确定性 reconciliation 语义:
618+
- 没有 apply outcome 时返回有界 `no-apply-outcome`
619+
- 后续 superseding audit 会把上一条 apply outcome 标记为 drifted,
620+
- active threshold divergence 会独立于 audit supersession 单独报告。
619621
- 已补可执行证据:
620-
- `src/server.migration.test.ts` 现在覆盖 auditId mismatch 阻断、stale fingerprint 阻断、rollback apply 成功、reset apply 成功与持久化 audit 顺序断言
622+
- `src/server.migration.test.ts` 现在覆盖 apply 后即时 reconciliation、apply-outcome 文件持久化内容,以及后续 override 触发的 drift 检测
621623
- 已加固 runtime 门禁:
622-
- `src/knowledge.api.contract.test.ts``src/agent_workspace.verification.contract.test.ts``scripts/verify-agent-workspace-runtime.js` 现在对 notification-threshold apply 路由与 fingerprint/apply helper 做 fail-fast 断言。
624+
- `src/knowledge.api.contract.test.ts``src/agent_workspace.verification.contract.test.ts``scripts/verify-agent-workspace-runtime.js` 现在对 notification-threshold reconciliation 路由与 apply-outcome helper 做 fail-fast 断言。
623625
- 验证证据:
624-
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern \"notification threshold rollback apply guardrails stay deterministic\"`
626+
- `npm test -- src/server.migration.test.ts --runInBand --testNamePattern \"notification threshold apply outcome reconciliation stays deterministic\"`
625627
- `npm run test:agent-workspace:contracts`
626628
- `npm run verify:agent-workspace:runtime`
627629
- 后续方向判断:
628-
- 当前瓶颈从受控执行转向 post-apply reconciliation
629-
- M7.25 应继续收敛在 apply 结果对账,不要扩成更大的 remediation 或 UI 子系统。
630+
- 当前瓶颈从 latest-outcome readback 转向有界 operator handoff/history
631+
- M7.26 应继续收敛在 apply outcome history,不要扩成更大的 remediation 或 UI 子系统。
630632

631633
## 主线 vs 工作分支快照(2026-04-14)
632634

@@ -676,7 +678,7 @@
676678
| L2 检索层 | 可解释混合/向量检索 + 治理 | 分支规划增强中 | 主线当前为 file-backed 基线(`src/learning/store.ts`| 待主线出现对应模块证据后再收敛 |
677679
| L3 学习层 | 掌握诊断 + 路径/会话闭环 | 分支增强中 | 主线部分集成 | 契约与集成一致性 |
678680
| L4 交互层 | agent 对话 + focus/path pane 运行时 | 分支已实现 | 主线 M1-M4 已落入基线 | 继续通过 typed contract 扩展动作面 |
679-
| L5 治理层 | runbook/诊断/回放与自动化 | 分支增强中 | 主线已集成运维诊断持久化/分级/趋势历史/阈值治理 + runbook 自动化/阈值审计 + 自适应模拟/自动修复 + 回测/批准门禁 + 批准策略硬化/回归告警 + 批准策略漂移/升级 + 升级确认生命周期/审计 + 升级 SLA/提醒基线 + 通知摘要/抑制基线 + 交付日志可观测性 + 陈旧通知健康审计 + 异常/retention 治理 + 通知 SLO 治理 + 通知阈值覆盖/审计治理 + 回滚预览/drift-diff 治理 + 回滚 apply guardrails | M7.25:通知阈值 apply 结果对账 |
681+
| L5 治理层 | runbook/诊断/回放与自动化 | 分支增强中 | 主线已集成运维诊断持久化/分级/趋势历史/阈值治理 + runbook 自动化/阈值审计 + 自适应模拟/自动修复 + 回测/批准门禁 + 批准策略硬化/回归告警 + 批准策略漂移/升级 + 升级确认生命周期/审计 + 升级 SLA/提醒基线 + 通知摘要/抑制基线 + 交付日志可观测性 + 陈旧通知健康审计 + 异常/retention 治理 + 通知 SLO 治理 + 通知阈值覆盖/审计治理 + 回滚预览/drift-diff 治理 + 回滚 apply guardrails + latest apply-outcome reconciliation | M7.26:通知阈值 apply outcome history surface |
680682

681683
## 验证基线
682684

scripts/verify-agent-workspace-runtime.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ function verifyAgentWorkspaceRuntime(repoRoot = path.resolve(__dirname, '..')) {
168168
serverSource.includes('/api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/apply'),
169169
'Missing diagnostics remediation escalation notification-threshold apply route in src/server.ts'
170170
);
171+
assert(
172+
serverSource.includes('/api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/reconciliation'),
173+
'Missing diagnostics remediation escalation notification-threshold reconciliation route in src/server.ts'
174+
);
171175
assert(
172176
serverSource.includes('/api/knowledge/operator/agent-workspace-diagnostics/triage/remediation/escalation/notification-thresholds/audit'),
173177
'Missing diagnostics remediation escalation notification-threshold audit route in src/server.ts'
@@ -360,6 +364,18 @@ function verifyAgentWorkspaceRuntime(repoRoot = path.resolve(__dirname, '..')) {
360364
serverSource.includes('applyAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdPreview'),
361365
'Missing remediation escalation notification threshold apply helper in src/server.ts'
362366
);
367+
assert(
368+
serverSource.includes('readAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome'),
369+
'Missing remediation escalation notification threshold apply outcome reader in src/server.ts'
370+
);
371+
assert(
372+
serverSource.includes('writeAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcome'),
373+
'Missing remediation escalation notification threshold apply outcome writer in src/server.ts'
374+
);
375+
assert(
376+
serverSource.includes('buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationThresholdApplyOutcomeReconciliation'),
377+
'Missing remediation escalation notification threshold reconciliation helper in src/server.ts'
378+
);
363379
assert(
364380
serverSource.includes('buildAgentWorkspaceDiagnosticsRemediationEscalationNotificationAnomalyReport'),
365381
'Missing remediation escalation notification anomaly report helper in src/server.ts'

0 commit comments

Comments
 (0)