@@ -164,17 +164,17 @@ func (e *Engine) classifyOnePath(
164164 }
165165 if rel , ok := isUnder (claudeDir , path ); ok {
166166 if ! strings .HasSuffix (path , ".jsonl" ) {
167- return DiscoveredFile {}, false
167+ continue
168168 }
169169 stem := strings .TrimSuffix (
170170 filepath .Base (path ), ".jsonl" ,
171171 )
172172 if strings .HasPrefix (stem , "agent-" ) {
173- return DiscoveredFile {}, false
173+ continue
174174 }
175175 parts := strings .Split (rel , sep )
176176 if len (parts ) != 2 {
177- return DiscoveredFile {}, false
177+ continue
178178 }
179179 return DiscoveredFile {
180180 Path : path ,
@@ -192,15 +192,15 @@ func (e *Engine) classifyOnePath(
192192 if rel , ok := isUnder (codexDir , path ); ok {
193193 parts := strings .Split (rel , sep )
194194 if len (parts ) != 4 {
195- return DiscoveredFile {}, false
195+ continue
196196 }
197197 if ! isDigits (parts [0 ]) ||
198198 ! isDigits (parts [1 ]) ||
199199 ! isDigits (parts [2 ]) {
200- return DiscoveredFile {}, false
200+ continue
201201 }
202202 if ! strings .HasSuffix (parts [3 ], ".jsonl" ) {
203- return DiscoveredFile {}, false
203+ continue
204204 }
205205 return DiscoveredFile {
206206 Path : path ,
@@ -226,28 +226,28 @@ func (e *Engine) classifyOnePath(
226226 parts [0 ], ".jsonl" ,
227227 )
228228 if ! ok {
229- return DiscoveredFile {}, false
229+ continue
230230 }
231231 dirEvents := filepath .Join (
232232 stateDir , stem , "events.jsonl" ,
233233 )
234234 if _ , err := os .Stat (dirEvents ); err == nil {
235- return DiscoveredFile {}, false
235+ continue
236236 }
237237 return DiscoveredFile {
238238 Path : path ,
239239 Agent : parser .AgentCopilot ,
240240 }, true
241241 case 2 :
242242 if parts [1 ] != "events.jsonl" {
243- return DiscoveredFile {}, false
243+ continue
244244 }
245245 return DiscoveredFile {
246246 Path : path ,
247247 Agent : parser .AgentCopilot ,
248248 }, true
249249 default :
250- return DiscoveredFile {}, false
250+ continue
251251 }
252252 }
253253 }
@@ -263,12 +263,12 @@ func (e *Engine) classifyOnePath(
263263 if len (parts ) != 4 ||
264264 parts [0 ] != "tmp" ||
265265 parts [2 ] != "chats" {
266- return DiscoveredFile {}, false
266+ continue
267267 }
268268 name := parts [3 ]
269269 if ! strings .HasPrefix (name , "session-" ) ||
270270 ! strings .HasSuffix (name , ".json" ) {
271- return DiscoveredFile {}, false
271+ continue
272272 }
273273 dirName := parts [1 ]
274274 if _ , ok := geminiProjectsByDir [geminiDir ]; ! ok {
@@ -1134,6 +1134,7 @@ func (e *Engine) syncSingleOpenCode(
11341134) error {
11351135 rawID := strings .TrimPrefix (sessionID , "opencode:" )
11361136
1137+ var lastErr error
11371138 for _ , dir := range e .opencodeDirs {
11381139 if dir == "" {
11391140 continue
@@ -1143,7 +1144,8 @@ func (e *Engine) syncSingleOpenCode(
11431144 dbPath , rawID , e .machine ,
11441145 )
11451146 if err != nil {
1146- continue // try next dir
1147+ lastErr = err
1148+ continue
11471149 }
11481150 if sess == nil {
11491151 continue
@@ -1157,6 +1159,11 @@ func (e *Engine) syncSingleOpenCode(
11571159 if len (e .opencodeDirs ) == 0 {
11581160 return fmt .Errorf ("opencode dir not configured" )
11591161 }
1162+ if lastErr != nil {
1163+ return fmt .Errorf (
1164+ "opencode session %s: %w" , sessionID , lastErr ,
1165+ )
1166+ }
11601167 return fmt .Errorf ("opencode session %s not found" , sessionID )
11611168}
11621169
0 commit comments