Skip to content

Change default sync_minutes from 0 to 10 in config, implement light...#10

Open
scaler-toad wants to merge 1 commit intomainfrom
toad/plf-3250-change-default-sync-minutes-fro-7c15a8445050d60b
Open

Change default sync_minutes from 0 to 10 in config, implement light...#10
scaler-toad wants to merge 1 commit intomainfrom
toad/plf-3250-change-default-sync-minutes-fro-7c15a8445050d60b

Conversation

@scaler-toad
Copy link

Summary

Change default sync_minutes from 0 to 10 in config, implement lightweight staleness check for ribbits that compares HEAD vs origin

Linear: PLF-3250

View Slack thread

Category: feature | Size: small

Suggested reviewers: @HergenD

Slack context

Implement two changes:

1. Change default sync_minutes from 0 to 10

In internal/config/config.go, the defaults() function (line 154) does not set Repos, so SyncMinutes defaults to Go's zero value (0 = disabled). Add a Repos field to the returned struct:

Repos: ReposConfig{
    SyncMinutes: 10,
},

Also update the comment on line 42 from // periodic git fetch interval; 0 = disabled (default) to // periodic git fetch interval; 0 = disabled, default 10.

2. Add lightweight staleness check to ribbits

In internal/ribbit/ribbit.go, add a package-level helper function:

// stalenessNote returns a Slack-formatted warning if the repo's HEAD differs
// from origin/HEAD (i.e. the local checkout is behind remote). Returns empty
// string if the check cannot be performed or the repo is up to date.
func stalenessNote(repoPath string) string {
    headCmd := exec.Command("git", "rev-parse", "HEAD")
    headCmd.Dir = repoPath
    headOut, err := headCmd.Output()
    if err != nil {
        return ""
    }
    originCmd := exec.Command("git", "rev-parse", "origin/HEAD")
    originCmd.Dir = repoPath
    originOut, err := originCmd.Output()
    if err != nil {
        return ""
    }
    if strings.TrimSpace(string(headOut)) == strings.TrimSpace(string(originOut)) {
        return ""
    }
    return "\n\n:warning: _Note: this repo may be slightly stale — the local checkout is behind origin. Answers are based on what's currently checked out._"
}

Add os/exec to the import block (it is not currently imported in ribbit.go).

In Engine.Respond(), after the agent result is obtained and the empty-check passes (around line 162), append the staleness note:

note := stalenessNote(repoPath)
return &Response{Text: result.Result + note}, nil

The note is appended only when HEAD and origin/HEAD differ, which is a purely local ref comparison with no network cost.


🐸 Created by toad tadpole

- Set SyncMinutes default to 10 in config defaults() so repos are
  periodically fetched out-of-the-box without requiring explicit config
- Update sync_minutes comment to reflect new default
- Add stalenessNote() helper in ribbit that compares HEAD vs origin/HEAD
  and appends a Slack warning when the local checkout is behind remote

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant