ci: harden docs agent fetch retries

This commit is contained in:
Peter Steinberger
2026-04-23 17:31:32 +01:00
parent a10c495f29
commit 884c117785
5 changed files with 62 additions and 49 deletions

View File

@@ -55,7 +55,17 @@ jobs:
exit 0
fi
git fetch --no-tags origin main
for attempt in 1 2 3 4 5; do
if git fetch --no-tags origin main; then
break
fi
if [ "$attempt" = "5" ]; then
echo "Failed to fetch main after retries." >&2
exit 1
fi
echo "Fetch attempt ${attempt} failed; retrying."
sleep $((attempt * 2))
done
remote_main="$(git rev-parse origin/main)"
if [ "$remote_main" != "$WORKFLOW_HEAD_SHA" ]; then
echo "CI run is superseded by ${remote_main}; skipping docs agent for ${WORKFLOW_HEAD_SHA}."
@@ -156,29 +166,26 @@ jobs:
exit 0
fi
git fetch --no-tags origin "${TARGET_BRANCH}"
remote_main="$(git rev-parse "origin/${TARGET_BRANCH}")"
if [ "$remote_main" != "$BASE_SHA" ]; then
echo "main advanced from ${BASE_SHA} to ${remote_main}; skipping stale docs update."
exit 0
fi
git config user.name "openclaw-docs-agent[bot]"
git config user.email "openclaw-docs-agent[bot]@users.noreply.github.com"
git add docs README.md CHANGELOG.md
git commit --no-verify -m "docs: refresh documentation"
for attempt in 1 2 3 4 5; do
if ! git fetch --no-tags origin "${TARGET_BRANCH}"; then
echo "Fetch attempt ${attempt} failed; retrying."
sleep $((attempt * 2))
continue
fi
if git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"${TARGET_BRANCH}"; then
exit 0
fi
git fetch --no-tags origin "${TARGET_BRANCH}"
remote_main="$(git rev-parse "origin/${TARGET_BRANCH}")"
if [ "$remote_main" != "$BASE_SHA" ]; then
echo "main advanced from ${BASE_SHA} to ${remote_main}; skipping stale docs update."
exit 0
fi
echo "Push attempt ${attempt} failed; retrying."
echo "Docs update attempt ${attempt} failed; retrying."
sleep $((attempt * 2))
done

View File

@@ -22,7 +22,7 @@ import {
} from "../../routing/session-key.js";
import { applyModelOverrideToSessionEntry } from "../../sessions/model-overrides.js";
import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js";
import type { BuildStatusTextParams } from "../../status/status-text.js";
import type { BuildStatusTextParams } from "../../status/status-text.types.js";
import { buildTaskStatusSnapshotForRelatedSessionKeyForOwner } from "../../tasks/task-owner-access.js";
import { formatTaskStatusDetail, formatTaskStatusTitle } from "../../tasks/task-status.js";
import { loadModelCatalog } from "../model-catalog.js";

View File

@@ -1,5 +1,6 @@
import { logVerbose } from "../../globals.js";
import { buildStatusText, type BuildStatusTextParams } from "../../status/status-text.js";
import { buildStatusText } from "../../status/status-text.js";
import type { BuildStatusTextParams } from "../../status/status-text.types.js";
import type { ReplyPayload } from "../types.js";
import type { CommandContext } from "./commands-types.js";
export { buildStatusText } from "../../status/status-text.js";

View File

@@ -14,21 +14,15 @@ import {
} from "../agents/tools/sessions-helpers.js";
import { normalizeGroupActivation } from "../auto-reply/group-activation.js";
import { resolveSelectedAndActiveModel } from "../auto-reply/model-runtime.js";
import type {
ElevatedLevel,
ReasoningLevel,
ThinkLevel,
VerboseLevel,
} from "../auto-reply/thinking.js";
import type { ThinkLevel } from "../auto-reply/thinking.js";
import { toAgentModelListLike } from "../config/model-input.js";
import type { SessionEntry, SessionScope } from "../config/sessions.js";
import type { SessionEntry } from "../config/sessions.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import {
formatUsageWindowSummary,
loadProviderUsageSummary,
resolveUsageProviderId,
} from "../infra/provider-usage.js";
import type { MediaUnderstandingDecision } from "../media-understanding/types.js";
import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js";
import {
listTasksForAgentIdForStatus,
@@ -39,35 +33,8 @@ import {
formatTaskStatusDetail,
formatTaskStatusTitle,
} from "../tasks/task-status.js";
export type BuildStatusTextParams = {
cfg: OpenClawConfig;
sessionEntry?: SessionEntry;
sessionKey: string;
parentSessionKey?: string;
sessionScope?: SessionScope;
storePath?: string;
statusChannel: string;
provider: string;
model: string;
contextTokens?: number;
resolvedThinkLevel?: ThinkLevel;
resolvedFastMode?: boolean;
resolvedHarness?: string;
resolvedVerboseLevel: VerboseLevel;
resolvedReasoningLevel: ReasoningLevel;
resolvedElevatedLevel?: ElevatedLevel;
resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
isGroup: boolean;
defaultGroupActivation: () => "always" | "mention";
mediaDecisions?: MediaUnderstandingDecision[];
taskLineOverride?: string;
skipDefaultTaskLookup?: boolean;
primaryModelLabelOverride?: string;
modelAuthOverride?: string;
activeModelAuthOverride?: string;
includeTranscriptUsage?: boolean;
};
import type { BuildStatusTextParams } from "./status-text.types.js";
export type { BuildStatusTextParams } from "./status-text.types.js";
const USAGE_OAUTH_ONLY_PROVIDERS = new Set([
"anthropic",

View File

@@ -0,0 +1,38 @@
import type {
ElevatedLevel,
ReasoningLevel,
ThinkLevel,
VerboseLevel,
} from "../auto-reply/thinking.js";
import type { SessionEntry, SessionScope } from "../config/sessions.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { MediaUnderstandingDecision } from "../media-understanding/types.js";
export type BuildStatusTextParams = {
cfg: OpenClawConfig;
sessionEntry?: SessionEntry;
sessionKey: string;
parentSessionKey?: string;
sessionScope?: SessionScope;
storePath?: string;
statusChannel: string;
provider: string;
model: string;
contextTokens?: number;
resolvedThinkLevel?: ThinkLevel;
resolvedFastMode?: boolean;
resolvedHarness?: string;
resolvedVerboseLevel: VerboseLevel;
resolvedReasoningLevel: ReasoningLevel;
resolvedElevatedLevel?: ElevatedLevel;
resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
isGroup: boolean;
defaultGroupActivation: () => "always" | "mention";
mediaDecisions?: MediaUnderstandingDecision[];
taskLineOverride?: string;
skipDefaultTaskLookup?: boolean;
primaryModelLabelOverride?: string;
modelAuthOverride?: string;
activeModelAuthOverride?: string;
includeTranscriptUsage?: boolean;
};