Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

wip(#6712 PR 4b lane A): pass holds print the pass resume argv (passResumeArgs)

garrytanbde8d737669a
diff --git a/src/core/persistence/sync-pass-run.ts b/src/core/persistence/sync-pass-run.ts
index 2b1becc3fa..4242748723 100644
--- a/src/core/persistence/sync-pass-run.ts
+++ b/src/core/persistence/sync-pass-run.ts
@@ -39,6 +39,7 @@ import { principalAttribution } from './attribution.ts';
import { resolveSlugForPath } from '../sync.ts';
import { syncOriginPath } from './sync-origin.ts';
import { originMarkerFingerprint } from './sync-markers.ts';
+import { passResumeArgs } from './sync-pass-readers.ts';
/** Rounds a pass runs before it stops `not_converged` (design §3.1). */
export const PASS_MAX_ROUNDS = 4;
@@ -300,7 +301,7 @@ export async function runSyncPass(engine: BrainEngine, input: SyncPassInput): Pr
const batchCursor = (entries: PassEntry[], stamp?: PassStamp): Cursor => ({ binding: { ...context.binding, owner_epoch: String(context.binding.owner_epoch), topology_generation: String(context.binding.topology_generation) },
root: context.root, gitRoot: context.gitRoot, sourceId, incarnation, from: context.source.last_commit, target: head, entries, slugMode: levelSlugMode, discoveredAt: startedAt,
runId: passId, passId, index: 0, authority, processingOptions, syncOptions: input.syncOptions, counts: { added: 0, modified: 0, deleted: 0, chunks: 0 },
- failureKey: passFingerprint(sourceId, incarnation), ...(episode?.full_id ? { fullEpisode: episode.full_id } : {}), ...(stamp ? { stamp } : {}) });
+ failureKey: passFingerprint(sourceId, incarnation), resumeArgs: passResumeArgs(sourceId, { value, updated_at: startedAt }), ...(episode?.full_id ? { fullEpisode: episode.full_id } : {}), ...(stamp ? { stamp } : {}) });
let levelSlugMode: Cursor['slugMode'] = 'git-root';
/** Drains one batch; a stop is the pass's ending (the batch's counts are folded in either way). */
const drain = async (entries: PassEntry[], stamp?: PassStamp): Promise<SyncResult | null> => {
diff --git a/src/core/persistence/sync-run.ts b/src/core/persistence/sync-run.ts
index 756841abbc..fc7fa407a0 100644
--- a/src/core/persistence/sync-run.ts
+++ b/src/core/persistence/sync-run.ts
@@ -145,7 +145,7 @@ export interface Cursor extends SyncDiscovery { runId: string; index: number; au
* the pass's stamp (no entries; its checkpoint publishes the stamp). `fullEpisode`: the open `--full` episode its imports
* record. `failureKey`: the key a recorded failure of the batch is filed under (the pass row's fingerprint).
*/
- passId?: string; stamp?: PassStamp; fullEpisode?: string; failureKey?: string; }
+ passId?: string; stamp?: PassStamp; fullEpisode?: string; failureKey?: string; resumeArgs?: string[]; }
export interface CursorProgress { startedAt: number; startIndex: number; lastAt: number; lastIndex: number }
/**
* #6278 (1.5): the breaker state a run carries in its cursor. `stalled` lists the `preparation_stalled` receipts this run
@@ -569,7 +569,7 @@ const preparationStalled = (row: Pick<WriteRequest, 'state' | 'error_code'>) =>
/** The run's page requests, as `persistence_requests_sync_run_open` indexes them. */
const SYNC_PAGE_KINDS_SQL = "intent->>'kind' IN ('managed_sync_import','managed_sync_delete')";
/** The `gbrain sync` arguments a hold or receipt prints to resume this cursor with its own options. */
-const resumeArgsOf = (cursor: Cursor, run: { syncOptions: SyncCursorOptions; repoPath?: string }) =>
+const resumeArgsOf = (cursor: Cursor, run: { syncOptions: SyncCursorOptions; repoPath?: string }) => cursor.resumeArgs ??
managedSyncResumeArgs({ sourceId: cursor.sourceId, processingOptions: cursor.processingOptions, syncOptions: cursor.syncOptions ?? run.syncOptions, repoPath: run.repoPath });
/**