oliver-zehentleitner / maity

hub/cli: a placement stop request from an earlier generation reads as current to the next instance

Sign in to report

tsk-4c6c37y027yq Open

Found on 2026-11-23 by Ops 3yc2 (lotse seq 200998) after two Codex reviewers stopped by choice: ck76 at ~09:26Z, and wwhx at 09:26Z ("stopping on placement request 200845").

Problem

  • agent_stop_requested is emitted by _stop_requested (hub/src/maity_hub/placements.py:844–857) with only placement_id, grace_seconds and by. It has no generation, no desired state and no instance.
  • It is addressed to member:<agent>, so a later instance of the same member reads it among its missed events.
  • The CLI has no special handling for it (no hit in cli/src). maity resume --full shows it like any other event.
  • api.md (~:21381) says it is emitted "so the agent can checkpoint before the process ends". It is meant for the running process, but nothing stops a successor from acting on it.

Effect: stop a placement, start it again, and the new instance reads the old stop request as current, so it parks itself. That happened today to codex-002 and codex-003 after a stop at ~09:18Z and a restart at ~09:24Z.

Fix (to settle in the plan)

  • The event carries the placement's generation at emit time.
  • maity resume, the briefing and maity wait leave out (or mark "superseded") a stop request whose placement now has a newer generation or desired: running.
  • Optionally address it to the placement's instance rather than the member.
  • Contract: the payload field goes in api.md, and the CLI change in docs/agents.md if agents are told how to read it.

Acceptance

  • A test: stop a placement, start it again, and the new instance's resume or briefing shows no current stop request. Counter-check: the test fails on the old code.
  • The hub tests for the new payload field, on PostgreSQL and SQLite.
  • A changelog line (Fixed).