sync: update from private repo (fd190dc)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-06 00:39:26 +00:00
parent afae52873b
commit caa0d03900
70 changed files with 294 additions and 208 deletions
+30
View File
@@ -129,6 +129,36 @@ describe('piece-runner review feedback flow', () => {
expect(instructions[4]).toContain('review 2: add conclusion');
});
it('defaults ownerId and userId to "local" for owner-less (no-auth) jobs', async () => {
workspacePath = makeWorkspace();
let capturedCtx: { ownerId?: unknown; userId?: unknown } | undefined;
executeMovementMock.mockImplementation(async (_movement, _instruction, _client, ctx) => {
capturedCtx = ctx as typeof capturedCtx;
return { next: 'COMPLETE', output: 'done', toolsUsed: [] };
});
// options omit ownerId/userId entirely — a no-auth job has no owner.
// (runPiece args: piece, instruction, client, workspace, callbacks, toolsConfig, options)
await runPiece(makePiece(), 'TASK', {} as never, workspacePath, undefined, undefined, {});
expect(capturedCtx?.ownerId).toBe('local');
expect(capturedCtx?.userId).toBe('local');
});
it('preserves a real ownerId/userId when the job is owned (auth mode)', async () => {
workspacePath = makeWorkspace();
let capturedCtx: { ownerId?: unknown; userId?: unknown } | undefined;
executeMovementMock.mockImplementation(async (_movement, _instruction, _client, ctx) => {
capturedCtx = ctx as typeof capturedCtx;
return { next: 'COMPLETE', output: 'done', toolsUsed: [] };
});
await runPiece(makePiece(), 'TASK', {} as never, workspacePath, undefined, undefined, { ownerId: 'alice', userId: 'alice' });
expect(capturedCtx?.ownerId).toBe('alice');
expect(capturedCtx?.userId).toBe('alice');
});
it('appends safe git status and diff context after verify loops', async () => {
workspacePath = makeGitWorkspace();
const instructions: string[] = [];
+6 -2
View File
@@ -725,12 +725,16 @@ function prepareMovementContext(
spawnSubTask: options?.spawnSubTask,
missionBrief: options?.missionBrief,
taskId: options?.taskId,
userId: options?.userId,
// No-auth jobs have no owner (ownerId/userId null). Resolve a single 'local'
// identity — matching where pieces already resolve (worker.ts: ownerId ?? 'local')
// — so MCP (global servers via ctx.ownerId) and the user folder / memory / notes
// (ctx.userId) work in single-tenant deployments instead of being disabled.
userId: options?.userId ?? 'local',
browserSessionState: options?.browserSessionState,
browserSessionProfileId: options?.browserSessionProfileId,
browserSessionProfile: options?.browserSessionProfile,
onAuthExpired: options?.onAuthExpired,
ownerId: options?.ownerId,
ownerId: options?.ownerId ?? 'local',
jobId: options?.jobId,
mcpConfig: options?.mcpConfig,
mcpQuotaState: { files: 0, bytes: 0 },