Skip to content

Commit 0bf7fc1

Browse files
committed
fix(codebuff): clear Freebuff baselines during reconciliation
When reconciling Codebuff candidates, also emit baseline entries for the Freebuff agent key. This ensures stale Freebuff baselines are cleared when the source is rejected by CWD filter or other admission checks, preventing incorrect tombstoning of preserved sessions.
1 parent 6d6c4ec commit 0bf7fc1

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

internal/sync/engine.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,12 +3382,23 @@ func (e *Engine) baselineReconciliationCandidates(
33823382
candidates []reconciliationCandidate,
33833383
admitted []db.SessionSourcePath,
33843384
) error {
3385-
sources := make([]db.SessionSourcePath, 0, len(candidates))
3385+
sources := make([]db.SessionSourcePath, 0, len(candidates)*2)
33863386
for _, candidate := range candidates {
3387+
path := e.effectiveSourcePath(candidate.Path)
33873388
sources = append(sources, db.SessionSourcePath{
33883389
Agent: string(candidate.Provider),
3389-
FilePath: e.effectiveSourcePath(candidate.Path),
3390+
FilePath: path,
33903391
})
3392+
// Freebuff shares the Codebuff provider but sessions are stored
3393+
// with agent=AgentFreebuff. Replace baselines for both agent
3394+
// keys so stale Freebuff baselines are cleared when the source
3395+
// is rejected by CWD filter or other admission checks.
3396+
if candidate.Provider == parser.AgentCodebuff {
3397+
sources = append(sources, db.SessionSourcePath{
3398+
Agent: string(parser.AgentFreebuff),
3399+
FilePath: path,
3400+
})
3401+
}
33913402
}
33923403
if err := e.db.ReplaceActiveSessionSourceBaselines(
33933404
ctx, e.machine, sources, admitted,

0 commit comments

Comments
 (0)