Commit 47f4188
fix(sandboxes): memory-store singleton, /snapshots route, .git skip on restore
Three bugs surfaced by the integration suite for Wedge 1.13:
1) Memory stores were instantiated fresh per builder call, so a snapshot
saved by POST /sandboxes/:id/snapshot was invisible to GET /snapshots
(different in-memory map). Same latent bug existed for MemoryTaskStore.
Both are now singletons constructed once per ComputerAgentServer
instance; durable backends (mongo, s3) are unaffected since the store
server is the source of truth.
2) GET /sandboxes/snapshots collided with GET /sandboxes/:id in Hono's
router (both 2-segment GET paths), so listing always returned 404
NOT_FOUND. Move snapshot list/delete to a top-level /snapshots prefix.
3) On restore, the loader recreates the gap repo's .git/ directory (incl.
read-only pack files like .git/objects/pack/*.idx). Layering snapshot
bytes over those failed with EACCES. The snapshot still captures .git
for fidelity; we just skip writing .git/* during restore — the loader
gets us a clean working tree.
scripts/test-sandboxes.py now uses the agent's Read tool (not /workdir,
which is wired to /run's run map, not the sandbox registry) to verify
the round-trip. 5/5 assertions pass end-to-end against api.clawagent.sh.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 808e03c commit 47f4188
2 files changed
Lines changed: 66 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
622 | 629 | | |
623 | | - | |
| 630 | + | |
624 | 631 | | |
625 | 632 | | |
626 | | - | |
627 | | - | |
628 | 633 | | |
629 | | - | |
| 634 | + | |
630 | 635 | | |
631 | 636 | | |
632 | 637 | | |
| |||
1314 | 1319 | | |
1315 | 1320 | | |
1316 | 1321 | | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1321 | 1329 | | |
1322 | 1330 | | |
1323 | 1331 | | |
| |||
1335 | 1343 | | |
1336 | 1344 | | |
1337 | 1345 | | |
1338 | | - | |
1339 | | - | |
| 1346 | + | |
| 1347 | + | |
1340 | 1348 | | |
1341 | 1349 | | |
1342 | 1350 | | |
| |||
1886 | 1894 | | |
1887 | 1895 | | |
1888 | 1896 | | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
1889 | 1904 | | |
1890 | 1905 | | |
1891 | 1906 | | |
| |||
1898 | 1913 | | |
1899 | 1914 | | |
1900 | 1915 | | |
1901 | | - | |
| 1916 | + | |
1902 | 1917 | | |
1903 | 1918 | | |
1904 | 1919 | | |
| |||
2094 | 2109 | | |
2095 | 2110 | | |
2096 | 2111 | | |
2097 | | - | |
2098 | | - | |
| 2112 | + | |
| 2113 | + | |
2099 | 2114 | | |
2100 | 2115 | | |
2101 | 2116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
394 | 417 | | |
395 | 418 | | |
396 | 419 | | |
397 | 420 | | |
398 | 421 | | |
399 | | - | |
400 | 422 | | |
401 | | - | |
402 | | - | |
403 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
404 | 426 | | |
405 | 427 | | |
406 | 428 | | |
| |||
413 | 435 | | |
414 | 436 | | |
415 | 437 | | |
416 | | - | |
417 | | - | |
418 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
419 | 442 | | |
420 | 443 | | |
421 | 444 | | |
422 | 445 | | |
| 446 | + | |
| 447 | + | |
423 | 448 | | |
424 | 449 | | |
425 | 450 | | |
| |||
460 | 485 | | |
461 | 486 | | |
462 | 487 | | |
463 | | - | |
| 488 | + | |
464 | 489 | | |
465 | 490 | | |
466 | 491 | | |
| |||
0 commit comments