fix(dispatch): fall back to FORGE_TOKEN env when ticket has no token
Some checks are pending
Security Scan / Go Vulnerability Check (push) Waiting to run
Security Scan / Secret Detection (push) Waiting to run
Security Scan / Dependency & Config Scan (push) Waiting to run

Tickets generated by poll-forge.sh don't include forge_token.
The dispatch runner now checks FORGE_TOKEN env var as fallback,
and gracefully skips reporting if no token is available.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-02-20 12:57:35 +00:00
parent a43cc099cd
commit 15d9d9483a
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -506,6 +506,15 @@ func execAgent(ctx context.Context, runner, model, prompt, dir, logPath string)
}
func reportToForge(t dispatchTicket, success bool, body string) {
token := t.ForgeToken
if token == "" {
token = os.Getenv("FORGE_TOKEN")
}
if token == "" {
log.Warn("No forge token available, skipping report")
return
}
url := fmt.Sprintf("%s/api/v1/repos/%s/%s/issues/%d/comments",
strings.TrimSuffix(t.ForgeURL, "/"), t.RepoOwner, t.RepoName, t.IssueNumber)
@ -517,7 +526,7 @@ func reportToForge(t dispatchTicket, success bool, body string) {
log.Error("Failed to create request", "err", err)
return
}
req.Header.Set("Authorization", "token "+t.ForgeToken)
req.Header.Set("Authorization", "token "+token)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 10 * time.Second}