Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Dispatch reads your local Copilot CLI session store and presents every past sess
- **Refresh** (`r`) — reload the session store without restarting
- **Demo mode** — `dispatch --demo` with synthetic data for experimentation
- **Self-update** — `dispatch update` checks GitHub Releases and upgrades in-place; background update check notifies on new versions
- **Maintenance** — `--rebuild-index` (manual rebuild of the session index via Copilot CLI PTY — repair action only), `--clear-cache` (reset config)
- **Maintenance** — `--reindex` (manual rebuild of the session index via Copilot CLI PTY — repair action only), `--clear-cache` (reset config)
- **Cross-platform** — Windows (amd64/arm64), macOS (amd64/arm64), Linux (amd64/arm64)

### Feature Highlights
Expand Down
6 changes: 5 additions & 1 deletion internal/data/chronicle.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ func ChronicleReindex(ctx context.Context, onLine func(line string)) error {
for {
n, rErr := ptty.Read(buf)
if n > 0 {
outCh <- string(buf[:n])
select {
case outCh <- string(buf[:n]):
case <-ctx.Done():
return
}
}
if rErr != nil {
return
Expand Down
10 changes: 9 additions & 1 deletion internal/data/dbwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ func (w *DBWatcher) loop() {
continue
}
if w.Poll() && w.onChange != nil {
w.onChange()
func() {
defer func() {
if r := recover(); r != nil {
// Swallow panic so the watcher loop survives.
_ = r
}
}()
w.onChange()
}()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/data/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func WriteContinuationPlan(sessionID string, remaining []string, summary string)
// Ensure the session directory exists (it may not if the session-state
// was created by the store but never had a plan written).
dir := filepath.Dir(path)
if err := os.MkdirAll(dir, 0o755); err != nil {
if err := os.MkdirAll(dir, 0o700); err != nil {
return fmt.Errorf("creating session dir: %w", err)
}

Expand Down
2 changes: 2 additions & 0 deletions internal/data/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ func (s *Store) searchRefs(ctx context.Context, query string, limit int) []Searc

rows, err := s.db.QueryContext(ctx, q, args...)
if err != nil {
slog.Debug("searchRefs query failed", "error", err)
return nil
}
defer rows.Close() //nolint:errcheck // rows read-only
Expand All @@ -792,6 +793,7 @@ func (s *Store) searchRefs(ctx context.Context, query string, limit int) []Searc
for rows.Next() {
var r SearchResult
if err := rows.Scan(&r.Content, &r.SessionID, &r.SourceType, &r.SourceID); err != nil {
slog.Debug("searchRefs scan failed", "error", err)
continue
}
r.Rank = -100 // boost ref matches to top
Expand Down
1 change: 1 addition & 0 deletions internal/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ func copyFile(src, dst string) error {

if _, err := io.Copy(out, in); err != nil {
_ = out.Close()
_ = os.Remove(dst)
return err
}

Expand Down
Loading