From 62431e3057a95b1ca0d7813c41929b413e58dc30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 05:52:02 +0000 Subject: [PATCH 1/4] Initial plan From 7cfe472187eed386689f368e37a56848bf0a2841 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 06:02:54 +0000 Subject: [PATCH 2/4] Fix hardcodedfilepath format-verb template detection Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../hardcodedfilepath/hardcodedfilepath.go | 16 ++++++++++------ .../src/hardcodedfilepath/hardcodedfilepath.go | 10 ++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pkg/linters/hardcodedfilepath/hardcodedfilepath.go b/pkg/linters/hardcodedfilepath/hardcodedfilepath.go index 85036a8354a..41f19dfec91 100644 --- a/pkg/linters/hardcodedfilepath/hardcodedfilepath.go +++ b/pkg/linters/hardcodedfilepath/hardcodedfilepath.go @@ -15,6 +15,7 @@ import ( "go/ast" "go/token" "go/types" + "regexp" "strings" "unicode/utf8" @@ -83,13 +84,16 @@ func isPathLike(val string) bool { return false } -// hasFormatVerb reports whether val contains common fmt format verbs. Strings -// with verbs are format templates, not standalone paths, so they are excluded. +var fmtDirectivePattern = regexp.MustCompile(`%(?:\[[0-9]+\])?[#0+\- ]*(?:\*|\d+)?(?:\.(?:\*|\d+))?[bcdeEfFgGopqstTUvwxX]`) + +// hasFormatVerb reports whether val contains fmt-style format directives. +// Strings with directives are format templates, not standalone paths, so they +// are excluded. Escaped percent pairs (%%) are ignored. func hasFormatVerb(val string) bool { - return strings.ContainsAny(val, "%") && - (strings.Contains(val, "%s") || strings.Contains(val, "%d") || - strings.Contains(val, "%v") || strings.Contains(val, "%q") || - strings.Contains(val, "%w") || strings.Contains(val, "%f")) + if !strings.Contains(val, "%") { + return false + } + return fmtDirectivePattern.MatchString(strings.ReplaceAll(val, "%%", "")) } // unquoteStringLit returns the raw string value of a Go string literal token, diff --git a/pkg/linters/hardcodedfilepath/testdata/src/hardcodedfilepath/hardcodedfilepath.go b/pkg/linters/hardcodedfilepath/testdata/src/hardcodedfilepath/hardcodedfilepath.go index 5dd991dc54f..cd107285531 100644 --- a/pkg/linters/hardcodedfilepath/testdata/src/hardcodedfilepath/hardcodedfilepath.go +++ b/pkg/linters/hardcodedfilepath/testdata/src/hardcodedfilepath/hardcodedfilepath.go @@ -70,6 +70,16 @@ func okFormatVerb() string { return fmt.Sprintf("/tmp/gh-aw/runs/%s/output.json", "run-id") } +// ok: path template literal with %x should be treated as a format template. +func okHexTemplateLiteral() string { + return "/tmp/gh-aw/%x.tmp" +} + +// bad: escaped %% is not a format verb and should still be reported. +func badEscapedPercentPath() string { + return "/tmp/gh-aw/100%%-done.log" // want `hard-coded file path.*consider extracting` +} + // ok: very short path segment (no trailing slash after prefix). func okShortSegment() string { return ".github" From 801e9c67265f7b3e4d6a9eb7aa599653614c73fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:02:32 +0000 Subject: [PATCH 3/4] Fix fmtDirectivePattern to handle indexed width/precision directives and add test fixture Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../agentic-workflows-dashboard/extension.mjs | 31 +++++++++++-------- .../web/index.html | 16 +++------- .../hardcodedfilepath/hardcodedfilepath.go | 2 +- .../hardcodedfilepath/hardcodedfilepath.go | 5 +++ 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/extensions/agentic-workflows-dashboard/extension.mjs b/.github/extensions/agentic-workflows-dashboard/extension.mjs index e143cdc7b32..e40f2c148a1 100644 --- a/.github/extensions/agentic-workflows-dashboard/extension.mjs +++ b/.github/extensions/agentic-workflows-dashboard/extension.mjs @@ -19,14 +19,19 @@ let workspacePath = process.cwd(); function execp(bin, args, cwd) { return new Promise((resolve, reject) => { - execFile(bin, args, { - cwd, - env: { ...process.env, NO_COLOR: "1", GH_NO_UPDATE_NOTIFIER: "1" }, - maxBuffer: 10 * 1024 * 1024, - }, (err, stdout, stderr) => { - if (err) reject(Object.assign(err, { stderr: stderr ?? "" })); - else resolve(stdout); - }); + execFile( + bin, + args, + { + cwd, + env: { ...process.env, NO_COLOR: "1", GH_NO_UPDATE_NOTIFIER: "1" }, + maxBuffer: 10 * 1024 * 1024, + }, + (err, stdout, stderr) => { + if (err) reject(Object.assign(err, { stderr: stderr ?? "" })); + else resolve(stdout); + } + ); }); } @@ -136,10 +141,7 @@ async function startServer() { try { if (pathname === "/" || pathname === "/index.html") { - const [html, css] = await Promise.all([ - readFile(join(__dirname, "web", "index.html"), "utf8"), - readFile(join(__dirname, "web", "styles.css"), "utf8"), - ]); + const [html, css] = await Promise.all([readFile(join(__dirname, "web", "index.html"), "utf8"), readFile(join(__dirname, "web", "styles.css"), "utf8")]); res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(html.replace("/*__APP_CSS__*/", css)); } else if (pathname === "/app.js") { @@ -268,7 +270,10 @@ It never calls Go code directly — all data is fetched by running CLI subcomman name: "refresh", description: "Clear the data cache so the next listDefinitions/listRuns fetches fresh data from the CLI.", inputSchema: { type: "object", additionalProperties: false }, - handler: () => { cache.clear(); return { ok: true }; }, + handler: () => { + cache.clear(); + return { ok: true }; + }, }, ], open: async ctx => { diff --git a/.github/extensions/agentic-workflows-dashboard/web/index.html b/.github/extensions/agentic-workflows-dashboard/web/index.html index 1d8eb4e4b26..310c93aa76b 100644 --- a/.github/extensions/agentic-workflows-dashboard/web/index.html +++ b/.github/extensions/agentic-workflows-dashboard/web/index.html @@ -57,20 +57,14 @@

Workflow definitions
Engine:
-
- Labels: -
-
- Time remaining: -
+
Labels:
+
Time remaining:
-
- No workflow definitions found. Run make build then open this canvas again. -
+
No workflow definitions found. Run make build then open this canvas again.
+
No runs found. Run gh aw logs to check availability.