codex-workflow-v2 2.0.0-beta.12.13 → 2.0.0-beta.12.15

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.
@@ -2,7 +2,7 @@ import { appendFileSync, existsSync, lstatSync, readFileSync, readdirSync } from
2
2
  import { createHash } from 'node:crypto';
3
3
  import path from 'node:path';
4
4
  import { PROTOCOL_VERSION, STATE_SCHEMA_VERSION, } from './contracts.js';
5
- import { inspectDependencyKnowledgeRefresh, inspectDependencyProvenanceRecovery, } from './dependency-provenance.js';
5
+ import { inspectBoundedWorkflowDependencyCommit, inspectDependencyKnowledgeRefresh, inspectDependencyProvenanceRecovery, } from './dependency-provenance.js';
6
6
  import { inspectHistoricalStepProvenanceRecovery, omittedStepEvidenceCommits, } from './historical-step-provenance.js';
7
7
  import { renderBrief, renderPlan, renderResult } from './artifacts.js';
8
8
  import { assertDelegationCanAuthorize, hashDelegationPolicy, prepareDelegationGrantGate, } from './delegation.js';
@@ -3833,36 +3833,43 @@ export class WorkflowService {
3833
3833
  });
3834
3834
  }
3835
3835
  const now = this.now();
3836
+ const recoveredRecords = preflight.dependencyCommits.map((dependencyCommit, index) => {
3837
+ const isTerminalCommit = index === preflight.dependencyCommits.length - 1;
3838
+ return {
3839
+ commitSha: dependencyCommit.commitSha,
3840
+ parentCommitSha: dependencyCommit.parentCommitSha,
3841
+ packageName: PACKAGE_NAME,
3842
+ packageVersion: dependencyCommit.packageVersion,
3843
+ files: ['package-lock.json', 'package.json'],
3844
+ actor: normalizedActor,
3845
+ reason: normalizedReason,
3846
+ recordedAt: now.toISOString(),
3847
+ retainedHistoricalCommits: isTerminalCommit ? preflight.retainedHistoricalCommits : [],
3848
+ ...(isTerminalCommit && preflight.activeDownstreamProof
3849
+ ? { activeDownstreamProof: preflight.activeDownstreamProof }
3850
+ : {}),
3851
+ ...(isTerminalCommit && preflight.downstreamProofReplan
3852
+ ? { downstreamProofReplan: preflight.downstreamProofReplan }
3853
+ : {}),
3854
+ ...(isTerminalCommit && preflight.historicalStepProvenance
3855
+ ? { historicalStepProvenance: preflight.historicalStepProvenance }
3856
+ : {}),
3857
+ ...(isTerminalCommit && preflight.planIntegrity
3858
+ ? { planIntegrity: preflight.planIntegrity }
3859
+ : {}),
3860
+ };
3861
+ });
3836
3862
  const nextTask = {
3837
3863
  ...task,
3838
3864
  revision: task.revision + 1,
3839
3865
  updatedAt: now.toISOString(),
3840
- systemCommits: [...task.systemCommits, preflight.commitSha],
3866
+ systemCommits: [
3867
+ ...task.systemCommits,
3868
+ ...preflight.dependencyCommits.map((dependencyCommit) => dependencyCommit.commitSha),
3869
+ ],
3841
3870
  dependencyProvenanceRecoveries: [
3842
3871
  ...(task.dependencyProvenanceRecoveries ?? []),
3843
- {
3844
- commitSha: preflight.commitSha,
3845
- parentCommitSha: preflight.parentCommitSha,
3846
- packageName: PACKAGE_NAME,
3847
- packageVersion: PACKAGE_VERSION,
3848
- files: ['package-lock.json', 'package.json'],
3849
- actor: normalizedActor,
3850
- reason: normalizedReason,
3851
- recordedAt: now.toISOString(),
3852
- retainedHistoricalCommits: preflight.retainedHistoricalCommits,
3853
- ...(preflight.activeDownstreamProof
3854
- ? { activeDownstreamProof: preflight.activeDownstreamProof }
3855
- : {}),
3856
- ...(preflight.downstreamProofReplan
3857
- ? { downstreamProofReplan: preflight.downstreamProofReplan }
3858
- : {}),
3859
- ...(preflight.historicalStepProvenance
3860
- ? { historicalStepProvenance: preflight.historicalStepProvenance }
3861
- : {}),
3862
- ...(preflight.planIntegrity
3863
- ? { planIntegrity: preflight.planIntegrity }
3864
- : {}),
3865
- },
3872
+ ...recoveredRecords,
3866
3873
  ],
3867
3874
  };
3868
3875
  if (recoveryMode !== 'plan-integrity' || !preflight.planIntegrity) {
@@ -6027,18 +6034,22 @@ export class WorkflowService {
6027
6034
  };
6028
6035
  }
6029
6036
  carriedPlanIntegrityUpdateCompatibility(snapshot, task) {
6030
- let parentCommit;
6031
- try {
6032
- parentCommit = runGit(snapshot.identity.repositoryRoot, ['rev-parse', 'HEAD^']);
6037
+ let boundaryCommit = headCommit(snapshot.identity.repositoryRoot);
6038
+ let dependencyCommitCount = 0;
6039
+ while (!task.systemCommits.includes(boundaryCommit)) {
6040
+ const dependencyCommit = inspectBoundedWorkflowDependencyCommit(snapshot.identity.repositoryRoot, boundaryCommit);
6041
+ if (!dependencyCommit)
6042
+ return null;
6043
+ boundaryCommit = dependencyCommit.parentCommitSha;
6044
+ dependencyCommitCount += 1;
6033
6045
  }
6034
- catch {
6046
+ if (dependencyCommitCount === 0)
6035
6047
  return null;
6036
- }
6037
6048
  const dirtyFiles = changedFiles(snapshot.identity.repositoryRoot).sort();
6038
6049
  const candidates = (task.dependencyProvenanceRecoveries ?? []).filter((record) => {
6039
6050
  const compatibility = record.planIntegrity;
6040
6051
  if (!compatibility
6041
- || record.commitSha !== parentCommit
6052
+ || record.commitSha !== boundaryCommit
6042
6053
  || !task.systemCommits.includes(record.commitSha)
6043
6054
  || compatibility.planHash !== task.planHash
6044
6055
  || canonicalJsonStringify([...compatibility.dirtyFiles].sort()) !== canonicalJsonStringify(dirtyFiles)