From f44c39ae3526c3b3d318ef809577f56e714ad426 Mon Sep 17 00:00:00 2001 From: Christopher Tso Date: Sat, 27 Jun 2026 11:33:21 +0200 Subject: [PATCH] fix(results): keep dashboard status read-only for repo paths --- apps/cli/test/commands/results/serve.test.ts | 8 +++++ packages/core/src/evaluation/results-repo.ts | 4 +-- .../core/test/evaluation/results-repo.test.ts | 32 +++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/cli/test/commands/results/serve.test.ts b/apps/cli/test/commands/results/serve.test.ts index 95fd1ab48..994756f8d 100644 --- a/apps/cli/test/commands/results/serve.test.ts +++ b/apps/cli/test/commands/results/serve.test.ts @@ -3497,12 +3497,20 @@ describe('serve app', () => { autoPush: false, }); + git(`git -C "${cloneDir}" fetch --quiet origin ${resultsBranch}`, tempDir); + const metadataRemoteRef = `refs/remotes/origin/${resultsBranch}`; const artifactRemoteRef = `refs/remotes/origin/${AGENTV_RESULTS_ARTIFACTS_REF}`; + const metadataRefLookup = () => + git( + `git -C "${cloneDir}" show-ref --verify --quiet ${metadataRemoteRef} && echo present || true`, + tempDir, + ); const artifactRefLookup = () => git( `git -C "${cloneDir}" show-ref --verify --quiet ${artifactRemoteRef} && echo present || true`, tempDir, ); + expect(metadataRefLookup()).toBe('present'); expect(artifactRefLookup()).toBe(''); const app = createApp([], tempDir, tempDir, undefined, { studioDir }); diff --git a/packages/core/src/evaluation/results-repo.ts b/packages/core/src/evaluation/results-repo.ts index 96171c666..7057fe7b7 100644 --- a/packages/core/src/evaluation/results-repo.ts +++ b/packages/core/src/evaluation/results-repo.ts @@ -2095,9 +2095,7 @@ export async function getResultsRepoSyncStatus(config?: ResultsConfig): Promise< try { if (usesStorageBranchWorktree(normalized)) { - await fetchResultsRepo(normalized.path, normalized.remote, normalized.branch).catch( - () => undefined, - ); + // Dashboard status is read-only; explicit sync paths do the fetch. return withGitInspection( baseStatus, await inspectResultsStorageBranchGit(normalized.path, normalized), diff --git a/packages/core/test/evaluation/results-repo.test.ts b/packages/core/test/evaluation/results-repo.test.ts index bfb418fc9..408546090 100644 --- a/packages/core/test/evaluation/results-repo.test.ts +++ b/packages/core/test/evaluation/results-repo.test.ts @@ -1001,6 +1001,38 @@ describe('results repo write path', () => { expect(remoteFiles).not.toContain('README.md'); }, 20000); + it('does not fetch a repo_path storage branch during status inspection', async () => { + const { remoteDir, seedDir } = initializeRemoteRepo(rootDir); + const projectDir = path.join(rootDir, 'source-project-status-readonly'); + git(`git clone --quiet "${remoteDir}" "${projectDir}"`, rootDir); + const originalOrigin = git('git remote get-url origin', projectDir); + const storageBranch = initializeRemoteStorageBranch(seedDir, DEFAULT_RESULTS_BRANCH); + const remoteRef = `refs/remotes/origin/${storageBranch}`; + + expect( + git(`git show-ref --verify --quiet "${remoteRef}" && echo present || true`, projectDir), + ).toBe(''); + + const status = await getResultsRepoSyncStatus({ + repo_path: projectDir, + branch: storageBranch, + remote: 'origin', + sync: { auto_push: false }, + }); + + expect(status).toMatchObject({ + configured: true, + available: true, + repo: projectDir, + repo_path: projectDir, + branch: storageBranch, + }); + expect(git('git remote get-url origin', projectDir)).toBe(originalOrigin); + expect( + git(`git show-ref --verify --quiet "${remoteRef}" && echo present || true`, projectDir), + ).toBe(''); + }, 20000); + it('commits repo_path metadata overlays to the configured storage branch during sync', async () => { const { remoteDir, seedDir } = initializeRemoteRepo(rootDir); const storageBranch = initializeRemoteStorageBranch(seedDir, DEFAULT_RESULTS_BRANCH);