orquesta-agent 0.2.281 → 0.2.283
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.
- package/dist/auto-pull.d.ts +37 -0
- package/dist/auto-pull.d.ts.map +1 -0
- package/dist/auto-pull.js +92 -0
- package/dist/auto-pull.js.map +1 -0
- package/dist/executor.d.ts +9 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +69 -5
- package/dist/executor.js.map +1 -1
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +6 -0
- package/dist/hook.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules for the daemon's automatic `git pull` (before every dispatched prompt,
|
|
3
|
+
* at startup, and when an interactive session opens).
|
|
4
|
+
*
|
|
5
|
+
* A failed pull used to be a console warning and nothing else: the prompt then
|
|
6
|
+
* ran against whatever the tree held, which can be days behind GitHub, and the
|
|
7
|
+
* only trace was a line in a log nobody reads on a customer machine. These
|
|
8
|
+
* helpers decide what a failure means and whether it is worth reporting to the
|
|
9
|
+
* dashboard (Settings → Agent → Agent Logs), so it is visible without being
|
|
10
|
+
* re-reported on every prompt of a tree that stays broken.
|
|
11
|
+
*/
|
|
12
|
+
export type PullFailureKind = 'dirty_tree' | 'autostash_conflict' | 'diverged' | 'auth' | 'network' | 'timeout' | 'other';
|
|
13
|
+
/** Classify git's output. Order matters: the more specific wording wins. */
|
|
14
|
+
export declare function classifyPullFailure(output: string, timedOut?: boolean): PullFailureKind;
|
|
15
|
+
export declare function describePullFailure(kind: PullFailureKind, branch: string | null): string;
|
|
16
|
+
/**
|
|
17
|
+
* Arguments for the pull itself. `--ff-only` so the daemon never creates a
|
|
18
|
+
* merge commit or rebases local work on its own; `--autostash` so uncommitted
|
|
19
|
+
* edits (a report the agent rewrites on every run, say) no longer freeze the
|
|
20
|
+
* tree at whatever commit it had. The stash is a commit, so it needs an
|
|
21
|
+
* identity: a fallback one is passed only when the repo has none configured.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildPullArgs(hasIdentity: boolean): string[];
|
|
24
|
+
/** git reports success but leaves conflict markers when the autostash does not re-apply cleanly. */
|
|
25
|
+
export declare function autostashConflicted(output: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Report a failure once per (directory, kind) until a pull in that directory
|
|
28
|
+
* succeeds again. Network blips are never reported: they heal on their own and
|
|
29
|
+
* would page the dashboard for nothing.
|
|
30
|
+
*/
|
|
31
|
+
export declare class PullFailureLedger {
|
|
32
|
+
private reported;
|
|
33
|
+
shouldReport(dir: string, kind: PullFailureKind): boolean;
|
|
34
|
+
/** A successful pull clears the directory, so the next failure is news again. */
|
|
35
|
+
succeeded(dir: string): boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=auto-pull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-pull.d.ts","sourceRoot":"","sources":["../src/auto-pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,oBAAoB,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEzH,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,eAAe,CAgCrF;AAYD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGxF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,CAG5D;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAqC;IAErD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO;IAOzD,iFAAiF;IACjF,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAGhC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules for the daemon's automatic `git pull` (before every dispatched prompt,
|
|
3
|
+
* at startup, and when an interactive session opens).
|
|
4
|
+
*
|
|
5
|
+
* A failed pull used to be a console warning and nothing else: the prompt then
|
|
6
|
+
* ran against whatever the tree held, which can be days behind GitHub, and the
|
|
7
|
+
* only trace was a line in a log nobody reads on a customer machine. These
|
|
8
|
+
* helpers decide what a failure means and whether it is worth reporting to the
|
|
9
|
+
* dashboard (Settings → Agent → Agent Logs), so it is visible without being
|
|
10
|
+
* re-reported on every prompt of a tree that stays broken.
|
|
11
|
+
*/
|
|
12
|
+
/** Classify git's output. Order matters: the more specific wording wins. */
|
|
13
|
+
export function classifyPullFailure(output, timedOut = false) {
|
|
14
|
+
if (timedOut)
|
|
15
|
+
return 'timeout';
|
|
16
|
+
const s = output.toLowerCase();
|
|
17
|
+
if (s.includes('would be overwritten by merge') ||
|
|
18
|
+
s.includes('commit your changes or stash them') ||
|
|
19
|
+
s.includes('you have unstaged changes') ||
|
|
20
|
+
s.includes('your index contains uncommitted changes') ||
|
|
21
|
+
s.includes('untracked working tree files would be'))
|
|
22
|
+
return 'dirty_tree';
|
|
23
|
+
if (s.includes('divergent branches') ||
|
|
24
|
+
s.includes('not possible to fast-forward') ||
|
|
25
|
+
s.includes('automatic merge failed') ||
|
|
26
|
+
s.includes('conflict ('))
|
|
27
|
+
return 'diverged';
|
|
28
|
+
if (s.includes('authentication failed') ||
|
|
29
|
+
s.includes('could not read username') ||
|
|
30
|
+
s.includes('permission denied (publickey)') ||
|
|
31
|
+
s.includes('repository not found') ||
|
|
32
|
+
s.includes('terminal prompts disabled'))
|
|
33
|
+
return 'auth';
|
|
34
|
+
if (s.includes('could not resolve host') ||
|
|
35
|
+
s.includes('unable to access') ||
|
|
36
|
+
s.includes('connection timed out') ||
|
|
37
|
+
s.includes('connection refused') ||
|
|
38
|
+
s.includes('network is unreachable') ||
|
|
39
|
+
s.includes('early eof'))
|
|
40
|
+
return 'network';
|
|
41
|
+
return 'other';
|
|
42
|
+
}
|
|
43
|
+
const HINTS = {
|
|
44
|
+
dirty_tree: 'uncommitted local changes block the pull — commit, stash or discard them on the machine',
|
|
45
|
+
autostash_conflict: 'uncommitted local changes clashed with the update — the tree now matches the remote and the local changes were kept in `git stash list` on the machine',
|
|
46
|
+
diverged: 'the local branch has commits that are not on the remote — merge or rebase it on the machine',
|
|
47
|
+
auth: 'git could not authenticate to the remote — reconnect the repository credentials',
|
|
48
|
+
network: 'the remote could not be reached',
|
|
49
|
+
timeout: 'git pull did not finish in time',
|
|
50
|
+
other: 'git pull failed',
|
|
51
|
+
};
|
|
52
|
+
export function describePullFailure(kind, branch) {
|
|
53
|
+
if (kind === 'autostash_conflict')
|
|
54
|
+
return `Auto-pull updated${branch ? ` ${branch}` : ''} but ${HINTS[kind]}.`;
|
|
55
|
+
return `Auto-pull failed${branch ? ` on ${branch}` : ''}: ${HINTS[kind]}. The run continues on the code already on disk.`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Arguments for the pull itself. `--ff-only` so the daemon never creates a
|
|
59
|
+
* merge commit or rebases local work on its own; `--autostash` so uncommitted
|
|
60
|
+
* edits (a report the agent rewrites on every run, say) no longer freeze the
|
|
61
|
+
* tree at whatever commit it had. The stash is a commit, so it needs an
|
|
62
|
+
* identity: a fallback one is passed only when the repo has none configured.
|
|
63
|
+
*/
|
|
64
|
+
export function buildPullArgs(hasIdentity) {
|
|
65
|
+
const identity = hasIdentity ? [] : ['-c', 'user.name=orquesta-agent', '-c', 'user.email=agent@getorquesta.com'];
|
|
66
|
+
return [...identity, 'pull', '--ff-only', '--autostash'];
|
|
67
|
+
}
|
|
68
|
+
/** git reports success but leaves conflict markers when the autostash does not re-apply cleanly. */
|
|
69
|
+
export function autostashConflicted(output) {
|
|
70
|
+
return /applying autostash resulted in conflicts/i.test(output);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Report a failure once per (directory, kind) until a pull in that directory
|
|
74
|
+
* succeeds again. Network blips are never reported: they heal on their own and
|
|
75
|
+
* would page the dashboard for nothing.
|
|
76
|
+
*/
|
|
77
|
+
export class PullFailureLedger {
|
|
78
|
+
reported = new Map();
|
|
79
|
+
shouldReport(dir, kind) {
|
|
80
|
+
if (kind === 'network' || kind === 'timeout')
|
|
81
|
+
return false;
|
|
82
|
+
if (this.reported.get(dir) === kind)
|
|
83
|
+
return false;
|
|
84
|
+
this.reported.set(dir, kind);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
/** A successful pull clears the directory, so the next failure is news again. */
|
|
88
|
+
succeeded(dir) {
|
|
89
|
+
return this.reported.delete(dir);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=auto-pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-pull.js","sourceRoot":"","sources":["../src/auto-pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,QAAQ,GAAG,KAAK;IAClE,IAAI,QAAQ;QAAE,OAAO,SAAS,CAAA;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAC9B,IACE,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC3C,CAAC,CAAC,QAAQ,CAAC,mCAAmC,CAAC;QAC/C,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QACvC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;QACrD,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QACnD,OAAO,YAAY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AC,IAAI,CAAC,GAAG,CAAA;IAC9G,OAAO,mBAAmB,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,kDAAkD,CAAA;AAC3H,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,WAAoB;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,kCAAkC,CAAC,CAAA;IAChH,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CAAA;AAC1D,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO,2CAA2C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAA;IAErD,YAAY,CAAC,GAAW,EAAE,IAAqB;QAC7C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAA;QAC1D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;YAAE,OAAO,KAAK,CAAA;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,iFAAiF;IACjF,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;CACF"}
|
package/dist/executor.d.ts
CHANGED
|
@@ -201,7 +201,15 @@ export declare function checkClaudeAuth(): {
|
|
|
201
201
|
*/
|
|
202
202
|
export declare function buildCloneArgs(repoUrl: string, targetDir: string, githubToken?: string): string[];
|
|
203
203
|
export declare function gitClone(repoUrl: string, targetDir: string, githubToken?: string): Promise<void>;
|
|
204
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Pull the current branch before work starts. Never throws: a failed pull
|
|
206
|
+
* leaves the run on the code already on disk, and the failure is reported to
|
|
207
|
+
* Agent Logs (once per directory and cause, see auto-pull.ts) so a tree that
|
|
208
|
+
* stopped updating is visible from the dashboard instead of only in a local log.
|
|
209
|
+
* A branch with no upstream (a local workstream branch) is skipped quietly —
|
|
210
|
+
* there is nothing to pull, and reporting it would fire on every prompt.
|
|
211
|
+
*/
|
|
212
|
+
export declare function gitPull(targetDir: string): Promise<boolean>;
|
|
205
213
|
/**
|
|
206
214
|
* Commit everything in `targetDir` and push the CURRENT branch.
|
|
207
215
|
*
|
package/dist/executor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAsItD,OAAO,EAAmI,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAsItD,OAAO,EAAmI,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAQhL,OAAO,EAA8C,YAAY,EAAyB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAa9I;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,EAAE,CAKtG;AAsPD,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAOhF;AAGD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B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAMjJ;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,WAAW,EAAE,CAgB9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAe/N;AAyCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA+BzD"}
|
package/dist/executor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn, execSync, execFileSync } from 'child_process';
|
|
1
|
+
import { spawn, execSync, execFileSync, spawnSync } from 'child_process';
|
|
2
2
|
// PTY binding for interactive sessions. We use @homebridge/node-pty-prebuilt-multiarch
|
|
3
3
|
// (a maintained fork that ships N-API prebuilds for linux-x64/arm64, darwin-x64/arm64,
|
|
4
4
|
// win32-x64) so customers never need a build toolchain on their VM. The try/catch
|
|
@@ -131,6 +131,7 @@ import { parseCoordSpec, runCoordination, runVideoCall } from './coordination.js
|
|
|
131
131
|
import { parseSudosudoInstallSpec, runSudosudoInstall } from './sudosudo.js';
|
|
132
132
|
import { sendOutput, sendComplete, sendError, sendSupervisionRequest, sendExecutionResumed, updatePromptStatus, persistOutputLogs, clearOutputBuffer, sendRequirement, persistRequirement, sendQAInstructions, persistQAInstructions, sendPlanItemsGenerated, sendSessionOutput, sendSessionStarted, sendSessionEnded, sendSessionError, sendSessionLog, reportAgentError, getAgentToken } from './supabase.js';
|
|
133
133
|
import { uploadPromptArtifacts } from './artifacts.js';
|
|
134
|
+
import { autostashConflicted, buildPullArgs, classifyPullFailure, describePullFailure, PullFailureLedger } from './auto-pull.js';
|
|
134
135
|
import { usageFromResultEvent } from './claude-usage.js';
|
|
135
136
|
import { startTranscriptTail, readTranscriptHistory, claudeChatSessionMode } from './claude-transcript.js';
|
|
136
137
|
import { createThinkingLog, createToolCallLog, createToolResultLog, createOutputLog, createErrorLog, createSystemLog, createProgressLog, } from './types/agent-logs.js';
|
|
@@ -1426,19 +1427,82 @@ export async function gitClone(repoUrl, targetDir, githubToken) {
|
|
|
1426
1427
|
throw new Error(redactSecrets(`Failed to clone repository: ${error}`));
|
|
1427
1428
|
}
|
|
1428
1429
|
}
|
|
1430
|
+
const pullFailures = new PullFailureLedger();
|
|
1431
|
+
/**
|
|
1432
|
+
* Pull the current branch before work starts. Never throws: a failed pull
|
|
1433
|
+
* leaves the run on the code already on disk, and the failure is reported to
|
|
1434
|
+
* Agent Logs (once per directory and cause, see auto-pull.ts) so a tree that
|
|
1435
|
+
* stopped updating is visible from the dashboard instead of only in a local log.
|
|
1436
|
+
* A branch with no upstream (a local workstream branch) is skipped quietly —
|
|
1437
|
+
* there is nothing to pull, and reporting it would fire on every prompt.
|
|
1438
|
+
*/
|
|
1429
1439
|
export async function gitPull(targetDir) {
|
|
1440
|
+
let branch = null;
|
|
1441
|
+
try {
|
|
1442
|
+
branch = execFileSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: targetDir, stdio: 'pipe', timeout: 10_000 }).toString().trim() || null;
|
|
1443
|
+
execFileSync('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], { cwd: targetDir, stdio: 'pipe', timeout: 10_000 });
|
|
1444
|
+
}
|
|
1445
|
+
catch {
|
|
1446
|
+
logger.debug(`Auto-pull skipped in ${targetDir}: ${branch ? `branch ${branch} has no upstream` : 'not on a branch'}`);
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1430
1449
|
logger.info('Pulling latest changes...');
|
|
1431
1450
|
try {
|
|
1432
|
-
|
|
1451
|
+
let hasIdentity = true;
|
|
1452
|
+
try {
|
|
1453
|
+
execFileSync('git', ['config', 'user.email'], { cwd: targetDir, stdio: 'pipe', timeout: 10_000 });
|
|
1454
|
+
}
|
|
1455
|
+
catch {
|
|
1456
|
+
hasIdentity = false;
|
|
1457
|
+
}
|
|
1458
|
+
// stderr is folded in: git prints the autostash outcome there even on exit 0.
|
|
1459
|
+
// LC_ALL=C: classifyPullFailure and autostashConflicted read git's English wording.
|
|
1460
|
+
const res = spawnSync('git', buildPullArgs(hasIdentity), {
|
|
1433
1461
|
cwd: targetDir,
|
|
1434
|
-
stdio: '
|
|
1462
|
+
stdio: 'pipe',
|
|
1435
1463
|
timeout: GIT_NET_TIMEOUT_MS,
|
|
1436
|
-
env: GIT_NONINTERACTIVE_ENV,
|
|
1464
|
+
env: { ...GIT_NONINTERACTIVE_ENV, LC_ALL: 'C' },
|
|
1437
1465
|
});
|
|
1466
|
+
const out = `${res.stdout?.toString() ?? ''}\n${res.stderr?.toString() ?? ''}`.trim();
|
|
1467
|
+
if (res.error || res.status !== 0) {
|
|
1468
|
+
throw Object.assign(new Error(out || String(res.error)), { stdout: res.stdout, stderr: res.stderr, code: res.error?.code, signal: res.signal });
|
|
1469
|
+
}
|
|
1470
|
+
if (out)
|
|
1471
|
+
logger.debug(redactSecrets(out));
|
|
1472
|
+
let unmerged = '';
|
|
1473
|
+
try {
|
|
1474
|
+
unmerged = execFileSync('git', ['diff', '--name-only', '--diff-filter=U'], { cwd: targetDir, stdio: 'pipe', timeout: 10_000 }).toString().trim();
|
|
1475
|
+
}
|
|
1476
|
+
catch { /* best effort */ }
|
|
1477
|
+
if (autostashConflicted(out) || unmerged) {
|
|
1478
|
+
// The pull landed but the stash did not re-apply cleanly: leave the tree on
|
|
1479
|
+
// the pulled commit (no conflict markers for the run to trip on) and the
|
|
1480
|
+
// local edits in the stash, where git already kept them.
|
|
1481
|
+
try {
|
|
1482
|
+
execFileSync('git', ['reset', '--hard', '-q', 'HEAD'], { cwd: targetDir, stdio: 'pipe', timeout: 10_000 });
|
|
1483
|
+
}
|
|
1484
|
+
catch { /* reported below */ }
|
|
1485
|
+
const message = describePullFailure('autostash_conflict', branch);
|
|
1486
|
+
logger.warn(message);
|
|
1487
|
+
if (pullFailures.shouldReport(targetDir, 'autostash_conflict')) {
|
|
1488
|
+
void reportAgentError('warn', 'git_pull', message, { kind: 'autostash_conflict', branch, workingDirectory: targetDir, output: redactSecrets(out).slice(-2000) });
|
|
1489
|
+
}
|
|
1490
|
+
return true;
|
|
1491
|
+
}
|
|
1492
|
+
pullFailures.succeeded(targetDir);
|
|
1438
1493
|
logger.success('Repository updated');
|
|
1494
|
+
return true;
|
|
1439
1495
|
}
|
|
1440
1496
|
catch (error) {
|
|
1441
|
-
|
|
1497
|
+
const e = error;
|
|
1498
|
+
const output = redactSecrets(`${e.stdout?.toString() ?? ''}\n${e.stderr?.toString() ?? ''}`.trim() || String(error));
|
|
1499
|
+
const kind = classifyPullFailure(output, e.code === 'ETIMEDOUT' || e.signal === 'SIGTERM');
|
|
1500
|
+
const message = describePullFailure(kind, branch);
|
|
1501
|
+
logger.warn(`${message}\n${output}`);
|
|
1502
|
+
if (pullFailures.shouldReport(targetDir, kind)) {
|
|
1503
|
+
void reportAgentError('warn', 'git_pull', message, { kind, branch, workingDirectory: targetDir, output: output.slice(-2000) });
|
|
1504
|
+
}
|
|
1505
|
+
return false;
|
|
1442
1506
|
}
|
|
1443
1507
|
}
|
|
1444
1508
|
/**
|