Commit 5fb7147
fix: AgentRuntime.snapshot/restore now dispatch to cloud API in cloud mode
Audit §7.1 fix. Previously, calling agent.snapshot()/agent.restore() in
cloud mode read from and wrote to self.backend (the local SQLite even when
in cloud mode), so a cloud-mode snapshot would capture 0 cloud keys and a
restore would silently no-op. The README example showed snapshot/restore
as a working feature but it didn't work for any cloud user.
This applies the same dispatch pattern as share()/read_shared() (fixed in
v3.1.4): if self._cloud_agent is set, route through the cloud client to
POST /v1/agents/<id>/snapshot and POST /v1/agents/<id>/restore. Otherwise
the existing local-backend path runs unchanged.
Verification:
- Cloud snapshot now captures cloud keys (verified: keys_captured=4)
- Cloud restore actually rolls back cloud state (verified: 'v2' -> 'v1')
- Local-mode snapshot/restore behavior unchanged (8/8 test_daemon pass)
- 55/59 full feature checks pass (was 54/59 with snapshot/restore failing)
- All 4 framework wrappers still round-trip in both modes
- CI smoke 6/6 pass
Pure additive change: +44 lines, 0 removed. The new code is gated behind
'if self._cloud_agent is not None', so local-mode users see no change.
Exception fallback returns an empty result rather than raising, matching
the cloud remember() pattern at runtime.py:298-310.
Cloud client signatures used: Agent.snapshot(label) and Agent.restore(snapshot_id)
from synrix/cloud.py:312-321. Server endpoints verified working via curl
during the original audit.
Refs: AUDIT.md §7.1 (only the snapshot/restore gap is addressed in this
commit; §7.2 messaging needs a new server endpoint, §7.3 blocked_by_guard
needs a server-side fix for cloud_server.py:2121, both deferred to avoid
crossing the SDK/server boundary in one change.)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6031b44 commit 5fb7147
1 file changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1616 | 1616 | | |
1617 | 1617 | | |
1618 | 1618 | | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1619 | 1640 | | |
1620 | 1641 | | |
1621 | 1642 | | |
| |||
1655 | 1676 | | |
1656 | 1677 | | |
1657 | 1678 | | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
1658 | 1702 | | |
1659 | 1703 | | |
1660 | 1704 | | |
| |||
0 commit comments