Commit 2a97bf8
committed
fix(agent-worker): restart Metro after mobile build so preview shows the built app
Root cause of the stale mobile web preview ('Welcome to Expo' scaffold showing even
after the agent built the app): Metro boots on the scaffold BEFORE the agent edits
files, and its file-watcher never sees those edits — inotify is unreliable on the
Daytona FS (the Next.js path already force-polls via CHOKIDAR/WATCHPACK, but Metro
has no polling watcher). So Metro's module graph stays pinned to the scaffold; even
a hard refresh re-bundles from the stale server-side map. Reproduces on prod.
Fix (mobile only): after the edit stream finishes, restart the Metro dev server once.
A fresh 'expo start -c' re-crawls the workspace and reads the agent's edited files,
sidestepping the watcher entirely. Reuses existing process-replacement (startProcess
kills the old app-preview + frees port 8081) and the deterministic port-8081 preview
URL, so the client URL is unchanged. New restartMobilePreview() + a gated await before
snapshotAppBuilderWorkspace; extracted executeAppBuilderRunPath to keep complexity <=15.
Also added -c to the Expo argv (defense-in-depth, matches V1). Web/Next.js untouched.
Gate green (18/18).1 parent 1b40eac commit 2a97bf8
2 files changed
Lines changed: 77 additions & 31 deletions
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
150 | 170 | | |
151 | 171 | | |
152 | 172 | | |
| |||
415 | 435 | | |
416 | 436 | | |
417 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
418 | 441 | | |
419 | 442 | | |
420 | 443 | | |
421 | 444 | | |
422 | 445 | | |
| 446 | + | |
423 | 447 | | |
424 | 448 | | |
425 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
510 | 511 | | |
511 | 512 | | |
512 | 513 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
518 | 564 | | |
519 | 565 | | |
520 | | - | |
521 | 566 | | |
522 | 567 | | |
523 | 568 | | |
524 | 569 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | 570 | | |
546 | | - | |
547 | | - | |
| 571 | + | |
| 572 | + | |
548 | 573 | | |
549 | 574 | | |
550 | 575 | | |
551 | 576 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | 577 | | |
556 | 578 | | |
557 | 579 | | |
| |||
0 commit comments