Skip to main content

Module background_task_exit

Module background_task_exit 

Source
Expand description

Ends a background task’s row when its command exits, from srv itself (docs/specs/SPEC_BACKGROUND_TASK_STRUCTURED_FEED_AND_SWARM_OWNERSHIP_2026_09_27.md §5, first bullet).

agentmux-bashwrap publishes a terminal chunk with the real exit code when the command it runs ends. Until now only an open pane read it, and only to print [exited N]; the row itself ended from the CLI’s task feed or the pane’s <task-notification>, and a CLI that died mid-task sent neither. The chunk is on the broker whether or not a pane is open, so this listens there. A chunk of a call that never went to the background finds no row and is ignored, and a row the CLI already ended stays as it ended (background_task_end_if_running).

Functions§

end_for_restarted_container
The container that ran block_id’s commands was started again or made anew, so nothing that ran in it before is running. A container pane files no pid (container_tool_chunk), so the liveness sweep can’t tell and these rows would stay running, then read as unknown in the dock for a day. They end here, at their last sighting. Returns how many rows ended; the pane is told to re-read when any did.
install
Start listening. Called once, with the app’s broker and store.