agent-shell-concurrency-safety

Fix/avoid background-job races, subshell cwd scoping bugs, and state-restore-after-mutation bugs in agent shell automation