Address feedback: cache git version, improve error handling, add telemetry

- Cache the git version to avoid recomputing on repeated calls
- Refactor getGitVersion to getGitVersionOrThrow with detailed errors
- Add getGitVersion that logs errors and handles caching
- Add makeTelemetryDiagnostic helper to diagnostics.ts
- Add logGitVersionTelemetry function to log git version telemetry
- Call logGitVersionTelemetry in init-action.ts
- Add resetCachedGitVersion for testing
- Update tests to work with new function signatures and caching

Co-authored-by: henrymercer <14129055+henrymercer@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-16 17:19:46 +00:00
parent fc2bbb041e
commit c3dc529aef
15 changed files with 694 additions and 480 deletions
+4
View File
@@ -37,6 +37,7 @@ import {
import { EnvVar } from "./environment";
import { Feature, Features } from "./feature-flags";
import { loadPropertiesFromApi } from "./feature-flags/properties";
import { logGitVersionTelemetry } from "./git-utils";
import {
checkInstallPython311,
checkPacksForOverlayCompatibility,
@@ -433,6 +434,9 @@ async function run() {
);
}
// Log Git version telemetry
await logGitVersionTelemetry(config, logger);
// Forward Go flags
const goFlags = process.env["GOFLAGS"];
if (goFlags) {