@@ -1045,10 +1045,18 @@ func (r Runner) formatFilesSummary(raw string) string {
10451045}
10461046
10471047func (r Runner ) formatIssueSummary (raw string ) string {
1048+ description := strings .TrimSpace (raw )
10481049 lines := []string {"Issue report context" }
1049- if description := strings . TrimSpace ( raw ); description != "" {
1050+ if description != "" {
10501051 lines = append (lines , "Description: " + description )
10511052 }
1053+ bundle := issueReportBundle {
1054+ GeneratedAt : time .Now ().UTC ().Format (time .RFC3339Nano ),
1055+ Description : description ,
1056+ SessionID : r .SessionID ,
1057+ WorkingDirectory : strings .TrimSpace (r .WorkingDirectory ),
1058+ Model : r .model (),
1059+ }
10521060 if r .SessionID != "" {
10531061 lines = append (lines , "Session ID: " + string (r .SessionID ))
10541062 }
@@ -1062,19 +1070,63 @@ func (r Runner) formatIssueSummary(raw string) string {
10621070 path := strings .TrimSpace (provider .PromptDumpPath ())
10631071 if path != "" {
10641072 lines = append (lines , "Prompt dump path: " + path )
1073+ bundle .PromptDumpPath = path
10651074 }
10661075 entries := provider .CachedPromptDumpRequests ()
10671076 lines = append (lines , fmt .Sprintf ("Recent prompt dumps: %d" , len (entries )))
1068- for _ , entry := range recentPromptDumpSummaries (entries , 3 ) {
1069- lines = append (lines , "- " + entry )
1077+ summaries := recentPromptDumpSummaries (entries , 3 )
1078+ bundle .RecentPromptDumps = summaries
1079+ for _ , summary := range summaries {
1080+ lines = append (lines , "- " + summary )
10701081 }
10711082 } else {
10721083 lines = append (lines , "Prompt dump cache: unavailable" )
10731084 }
1074- lines = append (lines , "Submission: local context only; remote issue submission is not implemented in the Go runtime yet." )
1085+ if path := r .issueReportBundlePath (); path != "" {
1086+ if err := writeIssueReportBundle (path , bundle ); err != nil {
1087+ lines = append (lines , "Issue bundle error: " + err .Error ())
1088+ } else {
1089+ lines = append (lines , "Issue bundle path: " + path )
1090+ lines = append (lines , "Submission: local issue bundle prepared." )
1091+ }
1092+ } else {
1093+ lines = append (lines , "Issue bundle path: (not configured)" )
1094+ lines = append (lines , "Submission: local issue context prepared." )
1095+ }
10751096 return strings .Join (lines , "\n " )
10761097}
10771098
1099+ type issueReportBundle struct {
1100+ GeneratedAt string `json:"generated_at"`
1101+ Description string `json:"description,omitempty"`
1102+ SessionID contracts.ID `json:"session_id,omitempty"`
1103+ WorkingDirectory string `json:"working_directory,omitempty"`
1104+ Model string `json:"model,omitempty"`
1105+ PromptDumpPath string `json:"prompt_dump_path,omitempty"`
1106+ RecentPromptDumps []string `json:"recent_prompt_dumps,omitempty"`
1107+ }
1108+
1109+ func (r Runner ) issueReportBundlePath () string {
1110+ if strings .TrimSpace (r .SessionPath ) == "" || r .SessionID == "" {
1111+ return ""
1112+ }
1113+ return filepath .Join (filepath .Dir (r .SessionPath ), string (r .SessionID ), "issue-report.json" )
1114+ }
1115+
1116+ func writeIssueReportBundle (path string , bundle issueReportBundle ) error {
1117+ if strings .TrimSpace (path ) == "" {
1118+ return nil
1119+ }
1120+ if err := os .MkdirAll (filepath .Dir (path ), 0o700 ); err != nil {
1121+ return err
1122+ }
1123+ data , err := json .MarshalIndent (bundle , "" , " " )
1124+ if err != nil {
1125+ return err
1126+ }
1127+ return os .WriteFile (path , append (data , '\n' ), 0o600 )
1128+ }
1129+
10781130func recentPromptDumpSummaries (entries []anthropic.PromptDumpCacheEntry , limit int ) []string {
10791131 if limit <= 0 || len (entries ) == 0 {
10801132 return nil
0 commit comments