Skip to content

Commit 5f23722

Browse files
moltenbot000moltenhub-bot
andauthored
Review the failing log paths first, identify every root cause behind (#968)
Co-authored-by: moltenhub-bot <moltenhub-bot@users.noreply.github.com> Co-authored-by: Molten Bot 000 <260473928+moltenbot000@users.noreply.github.com>
1 parent 72aa0c2 commit 5f23722

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

internal/app/harness.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,6 +3244,7 @@ func isNonFatalHubSnapshotRefreshFailure(detail string, res execx.Result) bool {
32443244
return false
32453245
}
32463246
snapshotRefreshMarkers := []string{
3247+
"non-fatal prebuild snapshot refresh warning",
32473248
"prebuild hub snapshot refresh could not fetch live snapshot",
32483249
"hub snapshot refresh unavailable during build pre-step",
32493250
"hub snapshot refresh could not fetch live snapshot",
@@ -3252,6 +3253,7 @@ func isNonFatalHubSnapshotRefreshFailure(detail string, res execx.Result) bool {
32523253
existingSnapshotMarkers := []string{
32533254
"build kept existing `hub-snapshot.json` and completed",
32543255
"build continued using existing snapshot",
3256+
"build still completed",
32553257
"using existing snapshot",
32563258
}
32573259
if !containsAny(text, snapshotRefreshMarkers) {

internal/app/harness_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,6 +5380,44 @@ func TestRunCodexAllowsBuildPreStepHubSnapshotRefreshWarning(t *testing.T) {
53805380
}
53815381
}
53825382

5383+
func TestRunCodexAllowsNonFatalPrebuildSnapshotRefreshWarning(t *testing.T) {
5384+
t.Parallel()
5385+
5386+
targetDir := t.TempDir()
5387+
prompt := "display image in social sharing should be the product image"
5388+
firstCmd := codexCommand(targetDir, prompt)
5389+
5390+
fake := &fakeRunner{t: t, exps: []expectedRun{
5391+
{
5392+
cmd: firstCmd,
5393+
res: execx.Result{
5394+
Stdout: strings.Join([]string{
5395+
"Done: src/pages/schweebles.astro now passes `productImage` to `PageLayout`.",
5396+
"Verified:",
5397+
"`npm test` passed: 36 files, 185 tests.",
5398+
"`npm run typecheck` passed.",
5399+
"`npm run build` passed, and `dist/schweebles/index.html` contains product image social tags.",
5400+
"Validation note:",
5401+
"Failure: non-fatal prebuild snapshot refresh warning.",
5402+
"Error details: `MOLTENHUB_ADMIN_SNAPSHOT_KEY is not configured for this build` for NA/EU snapshot refresh. Build still completed.",
5403+
}, "\n"),
5404+
},
5405+
},
5406+
}}
5407+
5408+
var logs []string
5409+
h := New(fake)
5410+
h.Logf = func(format string, args ...any) {
5411+
logs = append(logs, fmt.Sprintf(format, args...))
5412+
}
5413+
if err := h.runCodex(context.Background(), agentruntime.Default(), targetDir, prompt, codexRunOptions{}, "", ""); err != nil {
5414+
t.Fatalf("runCodex() error = %v, want nil for non-fatal snapshot refresh warning", err)
5415+
}
5416+
if !strings.Contains(strings.Join(logs, "\n"), "action=hub_snapshot_refresh_unavailable") {
5417+
t.Fatalf("logs missing hub snapshot warning:\n%s", strings.Join(logs, "\n"))
5418+
}
5419+
}
5420+
53835421
func TestCodexReportedFailureDoesNotIgnoreIncompleteHubSnapshotRefreshFailure(t *testing.T) {
53845422
t.Parallel()
53855423

0 commit comments

Comments
 (0)