@stigmer/runner 3.1.4 → 3.1.6
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/.build-fingerprint +1 -1
- package/dist/activities/execute-cursor/attachment-resolver.js +1 -1
- package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/index.js +40 -2
- package/dist/activities/execute-cursor/index.js.map +1 -1
- package/dist/activities/execute-cursor/skill-resolver.js +1 -1
- package/dist/activities/execute-cursor/skill-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/workspace-provision.d.ts +23 -4
- package/dist/activities/execute-cursor/workspace-provision.js +17 -6
- package/dist/activities/execute-cursor/workspace-provision.js.map +1 -1
- package/dist/activities/execute-deep-agent/index.js +39 -6
- package/dist/activities/execute-deep-agent/index.js.map +1 -1
- package/dist/activities/execute-deep-agent/inline-publisher.d.ts +1 -1
- package/dist/activities/execute-deep-agent/post-stream.d.ts +1 -1
- package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +1 -1
- package/dist/activities/execute-deep-agent/streaming-terminal.d.ts +1 -1
- package/dist/activities/execute-deep-agent/streaming.d.ts +1 -1
- package/dist/activities/execute-deep-agent/v3-status-builder.d.ts +1 -1
- package/dist/shared/execution-status-writer.d.ts +31 -0
- package/dist/shared/execution-status-writer.js +43 -0
- package/dist/shared/execution-status-writer.js.map +1 -0
- package/dist/shared/filereview/git-substrate.js +4 -0
- package/dist/shared/filereview/git-substrate.js.map +1 -1
- package/dist/shared/workspace/git-identity.d.ts +36 -0
- package/dist/shared/workspace/git-identity.js +39 -0
- package/dist/shared/workspace/git-identity.js.map +1 -0
- package/dist/shared/workspace/local-backend.d.ts +6 -2
- package/dist/shared/workspace/local-backend.js +6 -2
- package/dist/shared/workspace/local-backend.js.map +1 -1
- package/dist/shared/workspace/stigmer-link.d.ts +54 -0
- package/dist/shared/workspace/stigmer-link.js +92 -0
- package/dist/shared/workspace/stigmer-link.js.map +1 -0
- package/dist/shared/workspace/types.d.ts +6 -4
- package/dist/shared/workspace/writeback-coordinator.d.ts +120 -0
- package/dist/shared/workspace/writeback-coordinator.js +393 -0
- package/dist/shared/workspace/writeback-coordinator.js.map +1 -0
- package/package.json +2 -2
- package/src/activities/execute-cursor/__tests__/workspace-provision.test.ts +23 -15
- package/src/activities/execute-cursor/attachment-resolver.ts +1 -1
- package/src/activities/execute-cursor/index.ts +42 -2
- package/src/activities/execute-cursor/skill-resolver.ts +1 -1
- package/src/activities/execute-cursor/workspace-provision.ts +39 -7
- package/src/activities/execute-deep-agent/__tests__/post-stream.test.ts +1 -1
- package/src/activities/execute-deep-agent/index.ts +44 -6
- package/src/activities/execute-deep-agent/inline-publisher.ts +1 -1
- package/src/activities/execute-deep-agent/post-stream.ts +1 -1
- package/src/activities/execute-deep-agent/status-builder.ts +1 -1
- package/src/activities/execute-deep-agent/streaming-side-effects.ts +1 -1
- package/src/activities/execute-deep-agent/streaming-terminal.ts +1 -1
- package/src/activities/execute-deep-agent/streaming.ts +1 -1
- package/src/activities/execute-deep-agent/v3-status-builder.ts +1 -1
- package/src/shared/execution-status-writer.ts +56 -0
- package/src/shared/filereview/git-substrate.ts +4 -0
- package/src/shared/workspace/__tests__/git-identity.test.ts +124 -0
- package/src/shared/workspace/__tests__/stigmer-link.test.ts +173 -0
- package/src/shared/workspace/__tests__/writeback-coordinator.integration.test.ts +230 -0
- package/src/shared/workspace/__tests__/writeback-coordinator.test.ts +477 -0
- package/src/shared/workspace/git-identity.ts +41 -0
- package/src/shared/workspace/local-backend.ts +6 -2
- package/src/shared/workspace/stigmer-link.ts +97 -0
- package/src/shared/workspace/types.ts +6 -4
- package/src/{activities/execute-deep-agent → shared/workspace}/writeback-coordinator.ts +209 -93
- package/dist/activities/execute-cursor/stigmer-link.d.ts +0 -35
- package/dist/activities/execute-cursor/stigmer-link.js +0 -73
- package/dist/activities/execute-cursor/stigmer-link.js.map +0 -1
- package/dist/activities/execute-deep-agent/execution-status-writer.d.ts +0 -17
- package/dist/activities/execute-deep-agent/execution-status-writer.js +0 -9
- package/dist/activities/execute-deep-agent/execution-status-writer.js.map +0 -1
- package/dist/activities/execute-deep-agent/writeback-coordinator.d.ts +0 -71
- package/dist/activities/execute-deep-agent/writeback-coordinator.js +0 -295
- package/dist/activities/execute-deep-agent/writeback-coordinator.js.map +0 -1
- package/src/activities/execute-cursor/stigmer-link.ts +0 -78
- package/src/activities/execute-deep-agent/__tests__/writeback-coordinator.test.ts +0 -399
- package/src/activities/execute-deep-agent/execution-status-writer.ts +0 -19
|
@@ -40,10 +40,12 @@ export declare class WorkspaceProvisionError extends Error {
|
|
|
40
40
|
* commands route through the Daytona sandbox proxy.
|
|
41
41
|
*
|
|
42
42
|
* When `platformDir` is set, paths under `.stigmer/` are transparently
|
|
43
|
-
* routed to the platform directory instead of the workspace root
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* the agent
|
|
43
|
+
* routed to the platform directory instead of the workspace root, keeping
|
|
44
|
+
* platform files (skills, inputs) physically separate from the user's
|
|
45
|
+
* workspace. The routing covers the RUNNER's own reads/writes through
|
|
46
|
+
* this interface; the agent's file tools resolve against the workspace
|
|
47
|
+
* root and see the same files through the per-turn `.stigmer` symlink
|
|
48
|
+
* (see stigmer-link.ts).
|
|
47
49
|
*/
|
|
48
50
|
export interface WorkspaceBackend {
|
|
49
51
|
readonly rootDir: string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git write-back coordinator for workspace entries.
|
|
3
|
+
*
|
|
4
|
+
* Commits the workspace's changes to the session's write-back branch, pushes,
|
|
5
|
+
* and keeps one pull request open per session. The branch and PR are
|
|
6
|
+
* SESSION-scoped (`stigmer/<session-id>`): a session is one workstream, so
|
|
7
|
+
* every approved turn appends commits to the same branch and the same PR —
|
|
8
|
+
* mirroring how Cursor cloud agents and Codex present a session's deliverable.
|
|
9
|
+
* Execution-scoped branches were a modeling bug: each turn branched off the
|
|
10
|
+
* previous turn's branch, leaving a trail of superseded PRs.
|
|
11
|
+
*
|
|
12
|
+
* Because the branch outlives any single execution, every git/GitHub step is
|
|
13
|
+
* idempotent across coordinator instances: the branch is checked out if it
|
|
14
|
+
* already exists (locally, or on the remote after a sandbox re-provision), and
|
|
15
|
+
* an already-open PR for the branch is adopted instead of re-created.
|
|
16
|
+
*
|
|
17
|
+
* When this runs depends on the harness's file-review mode:
|
|
18
|
+
* - Capture mode (apply-then-review — every git workspace): the streaming
|
|
19
|
+
* trigger is suppressed and `finalize()` runs exactly once on the APPROVED
|
|
20
|
+
* tree, after review decisions reconcile (see processCaptureWriteback in
|
|
21
|
+
* index.ts). Speculative mid-turn edits never reach GitHub.
|
|
22
|
+
* - Legacy non-capture turns: `onFileModified(path)` triggers an incremental
|
|
23
|
+
* commit/push per file-modifying tool call (DD-5), with `finalize()` as the
|
|
24
|
+
* post-stream safety net.
|
|
25
|
+
*
|
|
26
|
+
* Concurrency: one mutex per workspace entry serializes git operations.
|
|
27
|
+
*/
|
|
28
|
+
import type { WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
29
|
+
import type { WorkspaceBackend, ProvisionResult } from "./types.js";
|
|
30
|
+
import type { ExecutionStatusWriter } from "../execution-status-writer.js";
|
|
31
|
+
export declare class WriteBackCoordinator {
|
|
32
|
+
private readonly statusWriter;
|
|
33
|
+
private readonly executionId;
|
|
34
|
+
private readonly workspaceBackend;
|
|
35
|
+
private readonly branchName;
|
|
36
|
+
/**
|
|
37
|
+
* Token for the GitHub PR API, plumbed explicitly from the resolved
|
|
38
|
+
* execution env (the same GITHUB_TOKEN that credentials the clone/push).
|
|
39
|
+
* Empty when the session has none — commit/push may still succeed via the
|
|
40
|
+
* repo-local credential store, so an empty token degrades to PUSHED with an
|
|
41
|
+
* actionable error rather than blocking the write-back.
|
|
42
|
+
*/
|
|
43
|
+
private readonly githubToken;
|
|
44
|
+
private readonly eligible;
|
|
45
|
+
private readonly state;
|
|
46
|
+
private readonly locks;
|
|
47
|
+
constructor(opts: {
|
|
48
|
+
statusWriter: ExecutionStatusWriter;
|
|
49
|
+
executionId: string;
|
|
50
|
+
/** The owning session's id — the branch/PR are session-scoped. */
|
|
51
|
+
sessionId: string;
|
|
52
|
+
githubToken: string;
|
|
53
|
+
provisionResults: readonly ProvisionResult[];
|
|
54
|
+
workspaceEntries: readonly WorkspaceEntry[];
|
|
55
|
+
workspaceBackend: WorkspaceBackend;
|
|
56
|
+
});
|
|
57
|
+
get hasEligibleEntries(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Called after a file-modifying tool completes (legacy non-capture turns
|
|
60
|
+
* only). Resolves the path to a workspace entry and runs an incremental
|
|
61
|
+
* commit/push cycle. Fire-and-forget: errors are logged, never thrown.
|
|
62
|
+
*/
|
|
63
|
+
onFileModified(path: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Commits and pushes every eligible workspace entry's remaining uncommitted
|
|
66
|
+
* changes. In capture mode this is THE write-back — invoked once on the
|
|
67
|
+
* approved tree after review reconcile; on legacy turns it is the
|
|
68
|
+
* post-stream safety net.
|
|
69
|
+
*/
|
|
70
|
+
finalize(): Promise<void>;
|
|
71
|
+
private initEligibleEntries;
|
|
72
|
+
private resolveEntry;
|
|
73
|
+
/**
|
|
74
|
+
* One write-back cycle for an entry: branch → commit → push → PR → status.
|
|
75
|
+
*
|
|
76
|
+
* Failure semantics are split by what actually succeeded (the phases are
|
|
77
|
+
* facts, not a single verdict):
|
|
78
|
+
* - branch/commit/push failure → FAILED (the work did not reach GitHub);
|
|
79
|
+
* - PR failure after a successful push → PUSHED with the PR error carried
|
|
80
|
+
* in `error` — the branch is live and usable, and saying "failed" for a
|
|
81
|
+
* pushed branch would be dishonest (the original cloud regression).
|
|
82
|
+
*/
|
|
83
|
+
private writeBackEntry;
|
|
84
|
+
private hasChanges;
|
|
85
|
+
/**
|
|
86
|
+
* Put the working tree on the session branch, wherever the branch already
|
|
87
|
+
* lives. Three cases, in order:
|
|
88
|
+
* 1. HEAD is already on it — a later turn in the same workspace (the common
|
|
89
|
+
* multi-turn path; the previous turn's cycle left HEAD there).
|
|
90
|
+
* 2. It exists locally or on the remote — a re-provisioned workspace whose
|
|
91
|
+
* clone lost the local branch. Checked out (tracking the remote ref when
|
|
92
|
+
* that is the only copy). The checkout carries this turn's uncommitted
|
|
93
|
+
* changes along; if they collide with the branch's prior commits git
|
|
94
|
+
* refuses, and the error surfaces as an honest FAILED record — we never
|
|
95
|
+
* force (-B) over the session's pushed history.
|
|
96
|
+
* 3. Neither — the session's first write-back creates it.
|
|
97
|
+
*/
|
|
98
|
+
private ensureBranch;
|
|
99
|
+
private commitAndPush;
|
|
100
|
+
/**
|
|
101
|
+
* Ensure one open PR exists for the session branch: adopt an already-open
|
|
102
|
+
* one (a prior turn — possibly a prior coordinator instance — created it),
|
|
103
|
+
* else create it. Runs only after a successful push; a thrown error here is
|
|
104
|
+
* reported as PUSHED + error, never FAILED.
|
|
105
|
+
*/
|
|
106
|
+
private ensurePr;
|
|
107
|
+
/** The open PR whose head is the session branch, if one exists. */
|
|
108
|
+
private findOpenPr;
|
|
109
|
+
private githubHeaders;
|
|
110
|
+
private updateStatus;
|
|
111
|
+
private withLock;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extract GitHub owner and repo from a clone URL.
|
|
115
|
+
* Supports HTTPS (with or without .git) and SSH formats.
|
|
116
|
+
*/
|
|
117
|
+
export declare function parseGithubRepo(repoUrl: string): {
|
|
118
|
+
owner: string;
|
|
119
|
+
repo: string;
|
|
120
|
+
};
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git write-back coordinator for workspace entries.
|
|
3
|
+
*
|
|
4
|
+
* Commits the workspace's changes to the session's write-back branch, pushes,
|
|
5
|
+
* and keeps one pull request open per session. The branch and PR are
|
|
6
|
+
* SESSION-scoped (`stigmer/<session-id>`): a session is one workstream, so
|
|
7
|
+
* every approved turn appends commits to the same branch and the same PR —
|
|
8
|
+
* mirroring how Cursor cloud agents and Codex present a session's deliverable.
|
|
9
|
+
* Execution-scoped branches were a modeling bug: each turn branched off the
|
|
10
|
+
* previous turn's branch, leaving a trail of superseded PRs.
|
|
11
|
+
*
|
|
12
|
+
* Because the branch outlives any single execution, every git/GitHub step is
|
|
13
|
+
* idempotent across coordinator instances: the branch is checked out if it
|
|
14
|
+
* already exists (locally, or on the remote after a sandbox re-provision), and
|
|
15
|
+
* an already-open PR for the branch is adopted instead of re-created.
|
|
16
|
+
*
|
|
17
|
+
* When this runs depends on the harness's file-review mode:
|
|
18
|
+
* - Capture mode (apply-then-review — every git workspace): the streaming
|
|
19
|
+
* trigger is suppressed and `finalize()` runs exactly once on the APPROVED
|
|
20
|
+
* tree, after review decisions reconcile (see processCaptureWriteback in
|
|
21
|
+
* index.ts). Speculative mid-turn edits never reach GitHub.
|
|
22
|
+
* - Legacy non-capture turns: `onFileModified(path)` triggers an incremental
|
|
23
|
+
* commit/push per file-modifying tool call (DD-5), with `finalize()` as the
|
|
24
|
+
* post-stream safety net.
|
|
25
|
+
*
|
|
26
|
+
* Concurrency: one mutex per workspace entry serializes git operations.
|
|
27
|
+
*/
|
|
28
|
+
import { create } from "@bufbuild/protobuf";
|
|
29
|
+
import { WorkspaceWriteBackSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/writeback_pb";
|
|
30
|
+
import { WorkspaceWriteBackPhase, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/writeback_pb";
|
|
31
|
+
import { GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
32
|
+
import { SourceType } from "./types.js";
|
|
33
|
+
import { gitCommitAsAgent } from "./git-identity.js";
|
|
34
|
+
const WRITE_BACK_ENABLED_MODES = new Set([
|
|
35
|
+
GitWriteBackMode.GIT_WRITE_BACK_MODE_UNSPECIFIED,
|
|
36
|
+
GitWriteBackMode.GIT_WRITE_BACK_BRANCH_AND_PR,
|
|
37
|
+
]);
|
|
38
|
+
const GITHUB_API = "https://api.github.com";
|
|
39
|
+
export class WriteBackCoordinator {
|
|
40
|
+
statusWriter;
|
|
41
|
+
executionId;
|
|
42
|
+
workspaceBackend;
|
|
43
|
+
branchName;
|
|
44
|
+
/**
|
|
45
|
+
* Token for the GitHub PR API, plumbed explicitly from the resolved
|
|
46
|
+
* execution env (the same GITHUB_TOKEN that credentials the clone/push).
|
|
47
|
+
* Empty when the session has none — commit/push may still succeed via the
|
|
48
|
+
* repo-local credential store, so an empty token degrades to PUSHED with an
|
|
49
|
+
* actionable error rather than blocking the write-back.
|
|
50
|
+
*/
|
|
51
|
+
githubToken;
|
|
52
|
+
eligible = new Map();
|
|
53
|
+
state = new Map();
|
|
54
|
+
locks = new Map();
|
|
55
|
+
constructor(opts) {
|
|
56
|
+
this.statusWriter = opts.statusWriter;
|
|
57
|
+
this.executionId = opts.executionId;
|
|
58
|
+
this.workspaceBackend = opts.workspaceBackend;
|
|
59
|
+
this.githubToken = opts.githubToken;
|
|
60
|
+
// The FULL session id: a truncated ULID is timestamp-dominated, so two
|
|
61
|
+
// sessions created near-simultaneously would collide on a short prefix.
|
|
62
|
+
this.branchName = `stigmer/${opts.sessionId}`;
|
|
63
|
+
this.initEligibleEntries(opts.provisionResults, opts.workspaceEntries);
|
|
64
|
+
}
|
|
65
|
+
get hasEligibleEntries() {
|
|
66
|
+
return this.eligible.size > 0;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Called after a file-modifying tool completes (legacy non-capture turns
|
|
70
|
+
* only). Resolves the path to a workspace entry and runs an incremental
|
|
71
|
+
* commit/push cycle. Fire-and-forget: errors are logged, never thrown.
|
|
72
|
+
*/
|
|
73
|
+
async onFileModified(path) {
|
|
74
|
+
try {
|
|
75
|
+
const entryName = this.resolveEntry(path);
|
|
76
|
+
if (!entryName)
|
|
77
|
+
return;
|
|
78
|
+
await this.withLock(entryName, () => this.writeBackEntry(entryName));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
console.warn(`[WriteBack] execution=${this.executionId} — ` +
|
|
82
|
+
`onFileModified error for '${path}': ${err}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Commits and pushes every eligible workspace entry's remaining uncommitted
|
|
87
|
+
* changes. In capture mode this is THE write-back — invoked once on the
|
|
88
|
+
* approved tree after review reconcile; on legacy turns it is the
|
|
89
|
+
* post-stream safety net.
|
|
90
|
+
*/
|
|
91
|
+
async finalize() {
|
|
92
|
+
for (const entryName of this.eligible.keys()) {
|
|
93
|
+
try {
|
|
94
|
+
await this.withLock(entryName, () => this.writeBackEntry(entryName));
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
console.warn(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
98
|
+
`finalize error: ${err}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ── Initialization ──────────────────────────────────────────────────
|
|
103
|
+
initEligibleEntries(provisionResults, workspaceEntries) {
|
|
104
|
+
const modeMap = new Map();
|
|
105
|
+
for (const entry of workspaceEntries) {
|
|
106
|
+
const source = entry.source;
|
|
107
|
+
if (source?.source.case === "gitRepo") {
|
|
108
|
+
modeMap.set(entry.name, source.source.value.writeBackMode);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const pr of provisionResults) {
|
|
112
|
+
if (pr.sourceType !== SourceType.GIT_REPO)
|
|
113
|
+
continue;
|
|
114
|
+
if (!pr.gitMetadata)
|
|
115
|
+
continue;
|
|
116
|
+
if (!pr.gitMetadata.gitCredentialsConfigured)
|
|
117
|
+
continue;
|
|
118
|
+
const mode = modeMap.get(pr.entryName) ?? GitWriteBackMode.GIT_WRITE_BACK_MODE_UNSPECIFIED;
|
|
119
|
+
if (!WRITE_BACK_ENABLED_MODES.has(mode))
|
|
120
|
+
continue;
|
|
121
|
+
this.eligible.set(pr.entryName, {
|
|
122
|
+
provisionResult: pr,
|
|
123
|
+
baseBranch: pr.gitMetadata.branch,
|
|
124
|
+
rootDir: pr.rootDir,
|
|
125
|
+
entryName: pr.entryName,
|
|
126
|
+
});
|
|
127
|
+
this.state.set(pr.entryName, {
|
|
128
|
+
branchReady: false,
|
|
129
|
+
prCreated: false,
|
|
130
|
+
prUrl: "",
|
|
131
|
+
prNumber: 0,
|
|
132
|
+
commitCount: 0,
|
|
133
|
+
lastCommitSha: "",
|
|
134
|
+
githubOwner: "",
|
|
135
|
+
githubRepo: "",
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (this.eligible.size > 0) {
|
|
139
|
+
console.log(`[WriteBack] execution=${this.executionId} — coordinator initialized with ` +
|
|
140
|
+
`${this.eligible.size} eligible workspace(s): ${[...this.eligible.keys()].join(", ")}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// ── Path Resolution ─────────────────────────────────────────────────
|
|
144
|
+
resolveEntry(path) {
|
|
145
|
+
if (this.eligible.size === 0)
|
|
146
|
+
return null;
|
|
147
|
+
if (this.eligible.size === 1)
|
|
148
|
+
return this.eligible.keys().next().value;
|
|
149
|
+
const normalized = path.replace(/^\/+/, "");
|
|
150
|
+
for (const entryName of this.eligible.keys()) {
|
|
151
|
+
if (normalized.startsWith(entryName + "/") || normalized === entryName) {
|
|
152
|
+
return entryName;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
// ── Core Write-Back Cycle ───────────────────────────────────────────
|
|
158
|
+
/**
|
|
159
|
+
* One write-back cycle for an entry: branch → commit → push → PR → status.
|
|
160
|
+
*
|
|
161
|
+
* Failure semantics are split by what actually succeeded (the phases are
|
|
162
|
+
* facts, not a single verdict):
|
|
163
|
+
* - branch/commit/push failure → FAILED (the work did not reach GitHub);
|
|
164
|
+
* - PR failure after a successful push → PUSHED with the PR error carried
|
|
165
|
+
* in `error` — the branch is live and usable, and saying "failed" for a
|
|
166
|
+
* pushed branch would be dishonest (the original cloud regression).
|
|
167
|
+
*/
|
|
168
|
+
async writeBackEntry(entryName) {
|
|
169
|
+
const entry = this.eligible.get(entryName);
|
|
170
|
+
const entryState = this.state.get(entryName);
|
|
171
|
+
const rootDir = entry.rootDir;
|
|
172
|
+
const exec = async (cmd) => {
|
|
173
|
+
return this.workspaceBackend.execute(`cd ${rootDir} && ${cmd}`);
|
|
174
|
+
};
|
|
175
|
+
try {
|
|
176
|
+
const hasChanges = await this.hasChanges(exec);
|
|
177
|
+
if (!hasChanges)
|
|
178
|
+
return;
|
|
179
|
+
if (!entryState.branchReady) {
|
|
180
|
+
await this.ensureBranch(entryName, entryState, exec);
|
|
181
|
+
}
|
|
182
|
+
await this.commitAndPush(entryName, entryState, exec);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
console.warn(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
186
|
+
`commit/push error: ${err}`);
|
|
187
|
+
const wb = create(WorkspaceWriteBackSchema, {
|
|
188
|
+
workspaceEntryName: entryName,
|
|
189
|
+
baseBranch: entry.baseBranch,
|
|
190
|
+
branchName: entryState.branchReady ? this.branchName : "",
|
|
191
|
+
phase: WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_FAILED,
|
|
192
|
+
error: String(err),
|
|
193
|
+
});
|
|
194
|
+
if (entryState.prCreated) {
|
|
195
|
+
wb.pullRequestUrl = entryState.prUrl;
|
|
196
|
+
wb.pullRequestNumber = entryState.prNumber;
|
|
197
|
+
}
|
|
198
|
+
this.statusWriter.addWriteBack(wb);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
let prError = "";
|
|
202
|
+
if (!entryState.prCreated) {
|
|
203
|
+
try {
|
|
204
|
+
await this.ensurePr(entryName, entryState, entry);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
console.warn(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
208
|
+
`PR error (branch is pushed): ${err}`);
|
|
209
|
+
prError = String(err);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
await this.updateStatus(entryName, entryState, entry, exec, prError);
|
|
213
|
+
}
|
|
214
|
+
// ── Git Operations ──────────────────────────────────────────────────
|
|
215
|
+
async hasChanges(exec) {
|
|
216
|
+
const diff = await exec("git diff --stat").catch(() => "");
|
|
217
|
+
const staged = await exec("git diff --cached --stat").catch(() => "");
|
|
218
|
+
if (diff.trim() || staged.trim())
|
|
219
|
+
return true;
|
|
220
|
+
const untracked = await exec("git ls-files --others --exclude-standard").catch(() => "");
|
|
221
|
+
return untracked.trim().length > 0;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Put the working tree on the session branch, wherever the branch already
|
|
225
|
+
* lives. Three cases, in order:
|
|
226
|
+
* 1. HEAD is already on it — a later turn in the same workspace (the common
|
|
227
|
+
* multi-turn path; the previous turn's cycle left HEAD there).
|
|
228
|
+
* 2. It exists locally or on the remote — a re-provisioned workspace whose
|
|
229
|
+
* clone lost the local branch. Checked out (tracking the remote ref when
|
|
230
|
+
* that is the only copy). The checkout carries this turn's uncommitted
|
|
231
|
+
* changes along; if they collide with the branch's prior commits git
|
|
232
|
+
* refuses, and the error surfaces as an honest FAILED record — we never
|
|
233
|
+
* force (-B) over the session's pushed history.
|
|
234
|
+
* 3. Neither — the session's first write-back creates it.
|
|
235
|
+
*/
|
|
236
|
+
async ensureBranch(entryName, entryState, exec) {
|
|
237
|
+
const current = (await exec("git branch --show-current").catch(() => "")).trim();
|
|
238
|
+
if (current === this.branchName) {
|
|
239
|
+
entryState.branchReady = true;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const localRef = await exec(`git rev-parse --verify --quiet refs/heads/${this.branchName}`).then((out) => out.trim(), () => "");
|
|
243
|
+
if (localRef) {
|
|
244
|
+
await exec(`git checkout ${this.branchName}`);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
const remoteRef = (await exec(`git ls-remote --heads origin ${this.branchName}`).catch(() => "")).trim();
|
|
248
|
+
if (remoteRef) {
|
|
249
|
+
await exec(`git fetch origin ${this.branchName}`);
|
|
250
|
+
await exec(`git checkout -b ${this.branchName} origin/${this.branchName}`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
await exec(`git checkout -b ${this.branchName}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
entryState.branchReady = true;
|
|
257
|
+
console.log(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
258
|
+
`on branch ${this.branchName}`);
|
|
259
|
+
}
|
|
260
|
+
async commitAndPush(entryName, entryState, exec) {
|
|
261
|
+
await exec("git add -A");
|
|
262
|
+
// Committed as the agent identity: the cloud sandbox has no git identity
|
|
263
|
+
// configured (a bare commit fails with "Author identity unknown"), and in
|
|
264
|
+
// local mode the agent's work should not be attributed to the host user.
|
|
265
|
+
// The execution id in the message links each commit back to its turn.
|
|
266
|
+
await exec(gitCommitAsAgent(`agent changes (${this.executionId})`));
|
|
267
|
+
entryState.commitCount++;
|
|
268
|
+
const shaOutput = await exec("git rev-parse HEAD");
|
|
269
|
+
entryState.lastCommitSha = shaOutput.trim();
|
|
270
|
+
// Always -u: idempotent whether this push creates the remote branch or
|
|
271
|
+
// appends to it, and it (re-)establishes tracking after a re-provision.
|
|
272
|
+
await exec(`git push -u origin ${this.branchName}`);
|
|
273
|
+
console.log(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
274
|
+
`commit pushed to ${this.branchName} (sha=${entryState.lastCommitSha.slice(0, 12)})`);
|
|
275
|
+
}
|
|
276
|
+
// ── GitHub PR ───────────────────────────────────────────────────────
|
|
277
|
+
/**
|
|
278
|
+
* Ensure one open PR exists for the session branch: adopt an already-open
|
|
279
|
+
* one (a prior turn — possibly a prior coordinator instance — created it),
|
|
280
|
+
* else create it. Runs only after a successful push; a thrown error here is
|
|
281
|
+
* reported as PUSHED + error, never FAILED.
|
|
282
|
+
*/
|
|
283
|
+
async ensurePr(entryName, entryState, entry) {
|
|
284
|
+
const meta = entry.provisionResult.gitMetadata;
|
|
285
|
+
if (!entryState.githubOwner) {
|
|
286
|
+
const { owner, repo } = parseGithubRepo(meta.repoUrl);
|
|
287
|
+
entryState.githubOwner = owner;
|
|
288
|
+
entryState.githubRepo = repo;
|
|
289
|
+
}
|
|
290
|
+
if (!this.githubToken) {
|
|
291
|
+
throw new Error("No GitHub token available to open a pull request. The branch " +
|
|
292
|
+
`'${this.branchName}' was pushed — open the PR manually, or configure ` +
|
|
293
|
+
"GITHUB_TOKEN for the session so PRs are created automatically.");
|
|
294
|
+
}
|
|
295
|
+
const existing = await this.findOpenPr(entryState);
|
|
296
|
+
if (existing) {
|
|
297
|
+
entryState.prCreated = true;
|
|
298
|
+
entryState.prUrl = existing.url;
|
|
299
|
+
entryState.prNumber = existing.number;
|
|
300
|
+
console.log(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
301
|
+
`adopted open PR #${existing.number}: ${existing.url}`);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const shortSessionId = this.branchName.replace(/^stigmer\//, "");
|
|
305
|
+
const prBody = `Automated pull request from a Stigmer agent session.\n\n` +
|
|
306
|
+
`**Session:** \`${shortSessionId}\`\n` +
|
|
307
|
+
`**Workspace:** \`${entryName}\`\n\n` +
|
|
308
|
+
`Each approved turn appends its commits to this pull request.\n`;
|
|
309
|
+
const resp = await fetch(`${GITHUB_API}/repos/${entryState.githubOwner}/${entryState.githubRepo}/pulls`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
headers: this.githubHeaders(),
|
|
312
|
+
body: JSON.stringify({
|
|
313
|
+
title: `Stigmer agent changes (${shortSessionId})`,
|
|
314
|
+
body: prBody,
|
|
315
|
+
head: this.branchName,
|
|
316
|
+
base: entry.baseBranch,
|
|
317
|
+
}),
|
|
318
|
+
});
|
|
319
|
+
if (!resp.ok) {
|
|
320
|
+
const body = await resp.text();
|
|
321
|
+
throw new Error(`GitHub API error (HTTP ${resp.status}): ${body}`);
|
|
322
|
+
}
|
|
323
|
+
const data = await resp.json();
|
|
324
|
+
entryState.prCreated = true;
|
|
325
|
+
entryState.prUrl = data.html_url ?? "";
|
|
326
|
+
entryState.prNumber = data.number ?? 0;
|
|
327
|
+
console.log(`[WriteBack] execution=${this.executionId} entry=${entryName} — ` +
|
|
328
|
+
`PR #${entryState.prNumber} created: ${entryState.prUrl}`);
|
|
329
|
+
}
|
|
330
|
+
/** The open PR whose head is the session branch, if one exists. */
|
|
331
|
+
async findOpenPr(entryState) {
|
|
332
|
+
const head = `${entryState.githubOwner}:${this.branchName}`;
|
|
333
|
+
const resp = await fetch(`${GITHUB_API}/repos/${entryState.githubOwner}/${entryState.githubRepo}` +
|
|
334
|
+
`/pulls?head=${encodeURIComponent(head)}&state=open`, { headers: this.githubHeaders() });
|
|
335
|
+
if (!resp.ok) {
|
|
336
|
+
const body = await resp.text();
|
|
337
|
+
throw new Error(`GitHub API error listing PRs (HTTP ${resp.status}): ${body}`);
|
|
338
|
+
}
|
|
339
|
+
const data = await resp.json();
|
|
340
|
+
const pr = data[0];
|
|
341
|
+
if (!pr)
|
|
342
|
+
return null;
|
|
343
|
+
return { url: pr.html_url ?? "", number: pr.number ?? 0 };
|
|
344
|
+
}
|
|
345
|
+
githubHeaders() {
|
|
346
|
+
return {
|
|
347
|
+
"Authorization": `Bearer ${this.githubToken}`,
|
|
348
|
+
"Accept": "application/vnd.github+json",
|
|
349
|
+
"Content-Type": "application/json",
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
// ── Status Reporting ────────────────────────────────────────────────
|
|
353
|
+
async updateStatus(entryName, entryState, entry, exec, prError) {
|
|
354
|
+
const summaryOutput = await exec(`git diff --stat ${entry.baseBranch}...HEAD`).catch(() => "");
|
|
355
|
+
const phase = entryState.prCreated
|
|
356
|
+
? WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_PR_CREATED
|
|
357
|
+
: WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_PUSHED;
|
|
358
|
+
const wb = create(WorkspaceWriteBackSchema, {
|
|
359
|
+
workspaceEntryName: entryName,
|
|
360
|
+
branchName: this.branchName,
|
|
361
|
+
baseBranch: entry.baseBranch,
|
|
362
|
+
commitSha: entryState.lastCommitSha,
|
|
363
|
+
pullRequestUrl: entryState.prUrl,
|
|
364
|
+
pullRequestNumber: entryState.prNumber,
|
|
365
|
+
diffSummary: summaryOutput.trim(),
|
|
366
|
+
phase,
|
|
367
|
+
// Non-empty only for a PUSHED record whose PR step failed: the branch
|
|
368
|
+
// is live, and the error tells the user why there is no PR link yet.
|
|
369
|
+
error: prError,
|
|
370
|
+
});
|
|
371
|
+
this.statusWriter.addWriteBack(wb);
|
|
372
|
+
}
|
|
373
|
+
// ── Concurrency ─────────────────────────────────────────────────────
|
|
374
|
+
async withLock(entryName, fn) {
|
|
375
|
+
const existing = this.locks.get(entryName) ?? Promise.resolve();
|
|
376
|
+
const next = existing.then(fn, fn);
|
|
377
|
+
this.locks.set(entryName, next);
|
|
378
|
+
await next;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// ── Helpers ───────────────────────────────────────────────────────────
|
|
382
|
+
/**
|
|
383
|
+
* Extract GitHub owner and repo from a clone URL.
|
|
384
|
+
* Supports HTTPS (with or without .git) and SSH formats.
|
|
385
|
+
*/
|
|
386
|
+
export function parseGithubRepo(repoUrl) {
|
|
387
|
+
const httpsMatch = repoUrl.match(/github\.com[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/);
|
|
388
|
+
if (httpsMatch) {
|
|
389
|
+
return { owner: httpsMatch[1], repo: httpsMatch[2] };
|
|
390
|
+
}
|
|
391
|
+
throw new Error(`Cannot parse GitHub owner/repo from URL: ${repoUrl}`);
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=writeback-coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeback-coordinator.js","sourceRoot":"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CAAC;IACb,CAAC;CACF;AAED,yEAAyE;AAEzE;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAC9B,8CAA8C,CAC/C,CAAC;IACF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,4CAA4C,OAAO,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/runner",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"description": "Embeddable Temporal worker for the Stigmer AI agent platform — handles agent execution, workflow orchestration, and MCP server management",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@opentelemetry/sdk-metrics": "^2.0.0",
|
|
86
86
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
87
87
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
88
|
-
"@stigmer/protos": "3.1.
|
|
88
|
+
"@stigmer/protos": "3.1.6",
|
|
89
89
|
"@temporalio/activity": "^1.11.0",
|
|
90
90
|
"@temporalio/client": "^1.11.0",
|
|
91
91
|
"@temporalio/common": "^1.11.0",
|