Skip to content

feat: sync-conflict guard + files copy-model visibility + rancher honesty (CLEAN-50) - #45

Merged
maksymhryzodub-prog merged 5 commits into
mainfrom
feat/CLEAN-50-agent-files-sync-safety
Sep 1, 2026
Merged

feat: sync-conflict guard + files copy-model visibility + rancher honesty (CLEAN-50)#45
maksymhryzodub-prog merged 5 commits into
mainfrom
feat/CLEAN-50-agent-files-sync-safety

Conversation

@maksymhryzodub-prog

@maksymhryzodub-progmaksymhryzodub-prog commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

CLEAN-50 — Mazda user report: SOUL.md edits "disappear" because the S3-vs-pod copy model is invisible and Sync pushes the pod's delta over S3 without ever checking S3 freshness (verified in runtime: mtime+size manifest push + orphan delete, no LastModified comparison).

  • CLEAN-52 / P1 — Sync guard: Agent.lastPullAt (set on genuine boot: bridle-driven running transition, drift resurrect uses pod startedAt) + Agent.lastSyncAt (set after successful sync). POST /agents/:id/files/sync computes at-risk S3 files (LastModified > max(lastSyncAt, lastPullAt − 60s)) and answers 409 + file list without syncing unless confirm: true. Legacy agents (null markers) keep pre-feature behavior. Admin UI shows a confirm dialog with the at-risk list; cancel leaves S3 untouched.
  • CLEAN-53 / P2 — Copy-model visibility: Files tab banner for Running agents (S3 copy shown, pod may hold newer content, Sync CTA, pull/sync moments), per-file last-modified tooltips, markers exposed in the agent DTO.
  • CLEAN-54 / P3 — Rancher honesty: SOUL.md gains exact http recipes for agent creation and knowledge binding (both were always possible via POST /agents / PUT /agents/{id} — the narration-without-calls gap was missing recipes), a "two copies" section, and write_agent_file result now carries an explicit restart-required notice. Propagation rides existing infra: template reseed by source hash on API boot + template-file resync on agent restart.

Design artifacts: specs/008-agent-files-sync-safety/ (spec, research, data-model, contracts, quickstart, tasks). Follow-up: CLEAN-51 (dedicated create/bind MCP tools).

Test plan

  • api: jest 190/190 (incl. new syncGuard.service.spec.ts — baseline math, null markers, margin, pass-through)
  • api build + swagger regen; admin build + client regen
  • Quickstart E2E on dev installation: scenarios 1-2 (conflict warn/cancel/confirm, no false alarm after restart), 3 (banner), 4 (rancher create+bind via http, restart notice), legacy-agent check

🤖 Generated with Claude Code

maksymhryzodub-progand others added 5 commits August 31, 2026 15:40
…LEAN-50)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…CLEAN-50)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…honesty (CLEAN-50)
Sync could silently overwrite S3 files edited after the pod's boot pull
(delta push never checks S3 freshness). The API now records lastPullAt /
lastSyncAt markers and answers 409 with an at-risk file list unless the
operator confirms; the Files tab explains the S3-vs-pod copy model and
surfaces per-file freshness; rancher's SOUL.md gets exact create/bind
recipes and write_agent_file результат reminds about the required restart.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nse (CLEAN-50)
The generated client is the axios variant — the success member of its result
union is a bare AxiosResponse without a `.response` field, so the conflict
check must first narrow on `error !== undefined`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@maksymhryzodub-prog
maksymhryzodub-prog merged commit 6f5e141 into mainSep 1, 2026
1 check passed
@maksymhryzodub-prog
maksymhryzodub-prog deleted the feat/CLEAN-50-agent-files-sync-safety branch September 7, 2026 12:52
Sign up for freeto 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

@maksymhryzodub-prog