Skip to content

Commit 07c7dec

Browse files
khaliqgantProactive Runtime Botagent-relay-code[bot]
authored
fix(mount): clear stale read-not-ready markers
* fix(mount): clear stale read-not-ready markers * chore: apply pr-reviewer fixes for #260 --------- Co-authored-by: Proactive Runtime Bot <agent@agent-relay.com> Co-authored-by: agent-relay-code[bot] <agent-relay-code[bot]@users.noreply.github.com>
1 parent fe47a82 commit 07c7dec

4 files changed

Lines changed: 207 additions & 193 deletions

File tree

.trajectories/active/traj_y5jru5dh9ku6/trajectory.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@
103103
"reasoning": "Current checkout canonicalizes Slack provider-relative paths in normalizeEnvelope, but ingestWebhook re-normalizes payload.path without provider and rejects /channels/... as invalid_input before queueing."
104104
},
105105
"significance": "high"
106+
},
107+
{
108+
"ts": 1780918977695,
109+
"type": "decision",
110+
"content": "Left PR #260 code unchanged after targeted review: Left PR #260 code unchanged after targeted review",
111+
"raw": {
112+
"question": "Left PR #260 code unchanged after targeted review",
113+
"chosen": "Left PR #260 code unchanged after targeted review",
114+
"alternatives": [],
115+
"reasoning": "Current checkout already addresses marker lifecycle paths in the diff; no bot review reported actionable code issues; targeted and full Go tests passed."
116+
},
117+
"significance": "high"
106118
}
107119
]
108120
}

.trajectories/index.json

Lines changed: 0 additions & 188 deletions
This file was deleted.

internal/mountsync/syncer.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,7 @@ func (s *Syncer) pullRemote(ctx context.Context, conflicted map[string]struct{})
25682568
// content already matches.
25692569
s.state.IncrementalCheckpoint = nil
25702570
s.state.IncrementalBacklogDraining = false
2571+
s.clearAllIncrementalReadNotReady()
25712572
return nil
25722573
}
25732574
feed, err := s.client.ListEvents(ctx, s.workspace, s.eventProvider, s.state.EventsCursor, 1)
@@ -2606,6 +2607,7 @@ func (s *Syncer) pullRemote(ctx context.Context, conflicted map[string]struct{})
26062607
s.state.EventsCursor = ""
26072608
s.state.IncrementalCheckpoint = nil
26082609
s.state.IncrementalBacklogDraining = false
2610+
s.clearAllIncrementalReadNotReady()
26092611
}
26102612

26112613
// Restart fast-path. When EventsCursor is empty but the state file
@@ -2696,6 +2698,7 @@ func (s *Syncer) pullRemote(ctx context.Context, conflicted map[string]struct{})
26962698
}
26972699
s.state.IncrementalCheckpoint = nil
26982700
s.state.IncrementalBacklogDraining = false
2701+
s.clearAllIncrementalReadNotReady()
26992702
if s.wsConn != nil {
27002703
return nil
27012704
}
@@ -3533,6 +3536,7 @@ func (s *Syncer) markBootstrapComplete() {
35333536
s.state.BootstrapStartedAt = ""
35343537
s.state.BootstrapFilesSynced = 0
35353538
s.state.BootstrapFilesTotal = 0
3539+
s.clearAllIncrementalReadNotReady()
35363540
// One-shot escape hatch / clobber-remnant recovery: after a single
35373541
// successful full reconcile, clear the in-memory force flag so
35383542
// subsequent cycles can use the fast-path again.
@@ -4193,7 +4197,6 @@ func (s *Syncer) applyIncrementalChanges(
41934197
if errors.As(err, &httpErr) && httpErr.StatusCode == http.StatusNotFound {
41944198
if s.incrementalReadNotReadyExpired(remotePath, time.Now().UTC()) {
41954199
s.logf("changed event for %s remained unreadable for at least %s; treating as deleted and advancing events cursor", remotePath, s.readNotReadyTTL)
4196-
s.clearIncrementalReadNotReady(remotePath)
41974200
if err := s.applyRemoteDelete(remotePath, conflicted); err != nil {
41984201
return err
41994202
}
@@ -4222,7 +4225,6 @@ func (s *Syncer) applyIncrementalChanges(
42224225
if err := s.applyRemoteFile(remotePath, file, conflicted); err != nil {
42234226
return err
42244227
}
4225-
s.clearIncrementalReadNotReady(remotePath)
42264228
s.markIncrementalCheckpoint(pageStartCursor, pageCursor, "changed", remotePath)
42274229
}
42284230

@@ -4238,7 +4240,6 @@ func (s *Syncer) applyIncrementalChanges(
42384240
if err := s.applyRemoteDelete(remotePath, conflicted); err != nil {
42394241
return err
42404242
}
4241-
s.clearIncrementalReadNotReady(remotePath)
42424243
s.markIncrementalCheckpoint(pageStartCursor, pageCursor, "deleted", remotePath)
42434244
}
42444245
return nil
@@ -4328,6 +4329,10 @@ func (s *Syncer) clearIncrementalReadNotReady(remotePath string) {
43284329
}
43294330
}
43304331

4332+
func (s *Syncer) clearAllIncrementalReadNotReady() {
4333+
s.state.IncrementalReadNotReadySince = nil
4334+
}
4335+
43314336
func (s *Syncer) resolveLatestEventCursor(ctx context.Context) (string, error) {
43324337
var lastErr error
43334338
attempts := defaultCursorResolutionAttempts
@@ -4435,7 +4440,12 @@ func cursorResolutionRetryDelay(timeout time.Duration, attempt int) time.Duratio
44354440
return delay
44364441
}
44374442

4438-
func (s *Syncer) applyRemoteFile(remotePath string, file RemoteFile, conflicted map[string]struct{}) error {
4443+
func (s *Syncer) applyRemoteFile(remotePath string, file RemoteFile, conflicted map[string]struct{}) (err error) {
4444+
defer func() {
4445+
if err == nil {
4446+
s.clearIncrementalReadNotReady(remotePath)
4447+
}
4448+
}()
44394449
if conflicted != nil {
44404450
if _, skip := conflicted[remotePath]; skip {
44414451
return nil
@@ -4592,7 +4602,12 @@ func scopeGrantsWrite(scope, filePath string) bool {
45924602
return true
45934603
}
45944604

4595-
func (s *Syncer) applyRemoteDelete(remotePath string, conflicted map[string]struct{}) error {
4605+
func (s *Syncer) applyRemoteDelete(remotePath string, conflicted map[string]struct{}) (err error) {
4606+
defer func() {
4607+
if err == nil {
4608+
s.clearIncrementalReadNotReady(remotePath)
4609+
}
4610+
}()
45964611
if conflicted != nil {
45974612
if _, skip := conflicted[remotePath]; skip {
45984613
return nil

0 commit comments

Comments
 (0)