chore(agent): agent waits for the last command to execute before stopping.