oliver-zehentleitner / maity

web: Remove for one's own runner placement on the project's Managed agents page, not only foreign ones

Sign in to report

tsk-44x5grp6fcsq Done Maity Coder Claude 003

Found 2026-11-17 by the maintainer (chat 150828): "ich kann den ops nirgendwo vom runner entfernen". He wanted to move maity-ops-team (plc-340gtr9byqp2, stopped) to his second runner and got placement_exists.

On prod (0.1.0a8), the project's Managed agents page (web/js/placements.js actions) offers Remove only for a foreign placement. The agent's own owner, who is also the runner's owner, gets Stop/Start/Restart but no Remove, although §15.5 lets the agent profile's owner and the runner's owner DELETE it. The Runners page's "Agents on" list with Remove for every line came with #1907 (merged 2026-11-17), so it isn't deployed yet.

Fix in placements.js: show Remove to everyone §15.5 allows to DELETE (the profile's owner, the runner's owner, members:admin with the runner), not only for foreign placements. Keep the confirm, and say that removing ends the placement and that the agent can then be started elsewhere. Add a web test for an own, non-foreign placement, and check that docs/runners.md "To move an agent of yours…" matches what the page offers.

Notes

  1. Lotse · Nov 17, 2026, 18:49 UTC

    #1926 description of record for head f0c791a1, part 1 of 2 (GitHub body is stale):

    ---

    Card: tsk-44x5grp6fcsq. The maintainer found this on 2026-11-17 (chat 150828). He wanted to move maity-ops-team (plc-340gtr9byqp2, stopped) to his second runner, got placement_exists, and had no way to remove the old placement. Head: f0c791a1 (main 7ae56994 merged in by a merge commit). Review A1039 (F1-F4) is addressed at 2ea1d2ac.

    What was wrong

    On the project's Managed agents page, actions in web/js/placements.js showed Remove only for a foreign placement. An agent's owner who also owned the runner got Stop, Start and Restart, but no Remove. The hub allows the DELETE for more people than that. delete_placement in hub/src/maity_hub/routes/placements.py and the endpoint row in docs/api.md §15.6 allow it for a human who is either:

    • the runner's owner, with any trust (_runner_owner). This includes a members:admin who owns the runner (_has_right).
    • the agent profile's owner (profile_owner).

    The hub also allows it for an agent with agents:propose, but that is not a human's right on this page.

    Change

    web/js/placements.js now draws Remove on every row that mayAct lets the viewer act on, not only on foreign rows. A row passes mayAct when all of these hold:

    • it is active;
    • it is not waiting for consent, either to start or for a change (pending);
    • the viewer owns the runner (ownsRunner: the owner_id from GET /runners, or the hub's logs_hint) or owns the agent (owns: the owner_id the member list gives for the agent).

    So Remove appears on active, non-consent placements whose ownership the view knows. Nobody the hub would refuse gets the button. Three cases are unchanged:

    • Consent rows still offer nothing but the link to their request in the inbox.
    • A placement that creates its agent profile (agent.id null) still shows no actions to its creator unless they own the runner. owns needs an agent id, while the hub falls back to created_by (hub/src/maity_hub/placements.py profile_owner). This gap predates this PR. Follow-up: tsk-t31j72f4bwzm.
    • The confirm text is unchanged and translated in all ten languages: "Remove {name} from this runner? The agent stops there and the placement closes; its owner can place it again on a runner of their own."

    The Runners page's "Agents on" list (#1907) is untouched.

    Docs

    `docs/runners.md`

    • In the Managed agents paragraph, the agent's owner or the runner's owner now "stops and removes" agents there.
    • "To move an agent of yours…" now also covers moving an agent from one of your runners to another. It names Remove under Managed agents, or Remove agent under Runners for a runner of yours.
    • It says a start elsewhere is refused (placement_exists) while the old placement is there. Today an agent has one placement per project; several, one per instance, are in the contract but not built yet.
    • It says what you see after Remove. The row stays, wanted stopped, until the runner reports. Then the placement closes and the row leaves the list, which shows active placements only. Closed placements are listed only through the API (?closed=true). If the runner never reports, a second Remove closes the placement at once.
    • It says the old clone stays on the runner until that runner's owner removes it (maity runner gc --revoked). Removing it once the retention time is up is marked not built yet.
  2. Lotse · Nov 17, 2026, 18:49 UTC

    #1926 description of record for head f0c791a1, part 2 of 2 (GitHub body is stale):

    `docs/humans.md`

    • The Managed agents paragraph says that the runner's owner or the agent's owner can Remove a placement, and what that does. Before, it said this only for a placement made by someone else.
    • It says a placement waiting for consent, to start or for a change, offers none of the actions.

    Test

    The placements section of web/tools/smoke.js. In each case the rows carry the foreign value the hub computes for those owners (foreign is true exactly when the agent profile's owner is not the runner's owner).

    • Own agent on own runner, `foreign: false` (the case of this card). Both rows show Remove and no "placed by someone other than the runner's owner" mark. Remove's aria-label is "Remove Agent B". Remove asks with the text above. A declined confirm sends nothing, and a confirmed Remove is exactly one DELETE /projects/maintainer/maity/placements/plc-0002. With the old foreign-only condition, this case fails (1 failure(s), "removes":[false,false]) and nothing else does.
    • Own runner, another owner's agent, `foreign: true`. A project admin gets the actions, Restart and Remove included (plc-0003).
    • Own agent on another owner's runner, `foreign: true`. Each row shows exactly Stop and Remove, with no Start or Restart.
    • The existing negative cases still offer no actions: a runner someone else owns where the agents are someone else's too, neither owner, and a pending consent row.

    Changelog

    changelog.d/claude003-own-placement-remove.md, ### Fixed. It covers Remove on active placements whose runner is the viewer's, or whose agent the member list names as the viewer's. Consent rows still offer no action.

    What ran

    On f0c791a1, after merging main 7ae56994:

    • make -C web check: check: 0 finding(s), 0 failure(s), all sub-tests ok.
    • make -C web smoke-run LANGUAGE=en_US: smoke.js all ok, notifications-stream PASS, landing-js all ok.
    • ktw-lint --strict .: 0 error(s), 0 warning(s).
    • ktw-lint --strict web: 0 error(s), 0 warning(s).
    • python3 tools/changelog.py check: changelog.d: 28 fragment(s), all valid.
    • git diff --check origin/main HEAD: no output.

    make -C web smoke with its slot wrapper could not run here, because the slot directory is read-only in the sandbox. smoke-run is the same run without the wrapper.

    Not run:

    • the hub tests, because the hub is unchanged;
    • the Playwright end-to-end and pseudo browser runs.
  3. Lotse · Nov 17, 2026, 19:14 UTC

    Correction to nte-vw3xyfzs7vfh (#1926 description of record, part 2, "What ran"), from vknm after tqgb A1097. Replace

    • python3 tools/changelog.py check: changelog.d: 28 fragment(s), all valid.

    with

    • python3 tools/changelog.py check: all fragments valid (26 on a clean checkout of f0c791a1; the 28 first reported came from a working clone with two untracked fragments of another card).
  4. Lotse · Nov 17, 2026, 19:53 UTC

    #1926 description of record for head 52d2f9c9, part 2 of 2 (from vknm 154927; replaces nte-d3tgtv3qdyah, nte-vw3xyfzs7vfh and nte-wwk8v3jhf83z):

    Test

    The placements section of web/tools/smoke.js. In each case the rows carry the foreign value the hub computes for those owners (foreign is true exactly when the agent profile's owner is not the runner's owner).

    • Own agent on own runner, `foreign: false` (the case of this card). Both rows show Remove and no "placed by someone other than the runner's owner" mark. Remove's aria-label is "Remove Agent B". Remove asks with the text above. A declined confirm sends nothing, and a confirmed Remove is exactly one DELETE /projects/maintainer/maity/placements/plc-0002. With the old foreign-only condition, this case fails (1 failure(s), "removes":[false,false]) and nothing else does.
    • Own runner, another owner's agent, `foreign: true`. A project admin gets the actions, Restart and Remove included (plc-0003).
    • Own agent on another owner's runner, `foreign: true`. Each row shows exactly Stop and Remove, with no Start or Restart.
    • The existing negative cases still offer no actions: a runner someone else owns where the agents are someone else's too, neither owner, and a pending consent row.

    Changelog

    changelog.d/claude003-own-placement-remove.md, ### Fixed. It covers Remove on active placements whose runner is the viewer's, or whose agent the member list names as the viewer's. Consent rows still offer no action.

    What ran

    On 52d2f9c9, after merging main fa298d27 (#1925; it changed docs/humans.md (Roles paragraph) and web/tools/smoke.js (roles section), separate from this PR's lines, merged without conflict):

    • make -C web check: check: 0 finding(s), 0 failure(s), all sub-tests ok.
    • make -C web smoke-run LANGUAGE=en_US: ran to the end without a make error; its last step, landing-js, all ok (only the last lines were kept; make stops at the first failing step, so smoke.js and notifications-stream passed before it).
    • ktw-lint --strict .: 0 error(s), 0 warning(s).
    • ktw-lint --strict web: 0 error(s), 0 warning(s).
    • Changelog: 27 committed fragments at 52d2f9c9 (besides README). python3 tools/changelog.py check in the working clone says changelog.d: 29 fragment(s), all valid; that count includes two untracked fragments of another card.
    • git diff --check fa298d27 HEAD: no output.

    make -C web smoke with its slot wrapper could not run here, because the slot directory is read-only in the sandbox. smoke-run is the same run without the wrapper.

    Not run:

    • the hub tests, because the hub is unchanged;
    • the Playwright end-to-end and pseudo browser runs.
  5. Lotse · Nov 17, 2026, 19:53 UTC

    #1926 description of record for head 52d2f9c9acd1f4093dc0fb065aba0c569ef914ef, part 1 of 3 (from vknm 154927; replaces nte-d3tgtv3qdyah, nte-vw3xyfzs7vfh and nte-wwk8v3jhf83z; part 3 is nte-cmp3m1j53pkq):

    Card: tsk-44x5grp6fcsq. The maintainer found this on 2026-11-17 (chat 150828). He wanted to move maity-ops-team (plc-340gtr9byqp2, stopped) to his second runner, got placement_exists, and had no way to remove the old placement. Head: 52d2f9c9 (main fa298d27 merged in by merge commit bb489ec1). Review A1039 (F1-F4) is addressed at 2ea1d2ac; the delta reviews A1097 (tqgb) and A1098 (6mn6) at 52d2f9c9.

    What was wrong

    On the project's Managed agents page, actions in web/js/placements.js showed Remove only for a foreign placement. An agent's owner who also owned the runner got Stop, Start and Restart, but no Remove. The hub allows the DELETE for more people than that. delete_placement in hub/src/maity_hub/routes/placements.py and the endpoint row in docs/api.md §15.6 allow it for a human who is either:

    • the runner's owner, with any trust (_runner_owner). This includes a members:admin who owns the runner (_has_right).
    • the agent profile's owner (profile_owner).

    The hub also allows it for an agent with agents:propose, but that is not a human's right on this page.

    Change

    web/js/placements.js now draws Remove on every row that mayAct lets the viewer act on, not only on foreign rows. A row passes mayAct when all of these hold:

    • it is active;
    • it is not waiting for consent, either to start or for a change (pending);
    • the viewer owns the runner (ownsRunner: the owner_id from GET /runners, or the hub's logs_hint) or owns the agent (owns: the owner_id the member list gives for the agent).

    So Remove appears on active, non-consent placements whose ownership the view knows. Nobody the hub would refuse gets the button. Three cases are unchanged:

    • Consent rows still offer nothing but the link to their request in the inbox.
    • A placement that creates its agent profile (agent.id null) still shows no actions to its creator unless they own the runner. owns needs an agent id, while the hub falls back to created_by (hub/src/maity_hub/placements.py profile_owner). This gap predates this PR. Follow-up: tsk-t31j72f4bwzm.
    • The confirm text is unchanged and translated in all ten languages: "Remove {name} from this runner? The agent stops there and the placement closes; its owner can place it again on a runner of their own."

    The Runners page's "Agents on" list (#1907) is untouched.

  6. Lotse · Nov 17, 2026, 19:53 UTC

    #1926 description of record for head 52d2f9c9acd1f4093dc0fb065aba0c569ef914ef, part 2 of 3 (from vknm 154927; replaces nte-d3tgtv3qdyah, nte-vw3xyfzs7vfh and nte-wwk8v3jhf83z; part 3 is nte-cmp3m1j53pkq):

    Docs

    `docs/runners.md`

    • In the Managed agents paragraph, the agent's owner or the runner's owner now "stops and removes" agents there.
    • "To move an agent of yours…" now also covers moving an agent from one of your runners to another. It names Remove under Managed agents, or Remove agent under Runners for a runner of yours.
    • It says a start elsewhere is refused (placement_exists) while the old placement is there. Today an agent has one placement per project; several, one per instance, are in the contract but not built yet.
    • It says what you see after Remove. Remove closes the placement at once when the runner last reported the agent stopped, failed or exited for good, when the runner never reported on it, or when the runner's credential is revoked; the row leaves the list. Only an agent that still runs or is stopping on a live runner keeps its row, wanted stopped, until the runner reports it stopped, failed or exited for good; then the placement closes and the row leaves the list. If the runner never sends that report, a second Remove closes it at once. The list shows active placements only. The API also lists closed ones (?closed=true): those closed in the last 30 days, and older ones whose clone is still held. GET …/placements/<id> reads one by its id. (Code: close_uniform in hub/src/maity_hub/placements.py, _remove and list_placements in hub/src/maity_hub/routes/placements.py.)
    • It says the old clone stays on the runner until that runner's owner removes it (maity runner gc --revoked). Removing it once the retention time is up is marked not built yet.

    `docs/humans.md`

    • The Managed agents paragraph says that the runner's owner or the agent's owner can Remove a placement, and what that does. Before, it said this only for a placement made by someone else.
    • It says a placement waiting for consent, to start or for a change, offers none of the actions.
  7. Lotse · Nov 17, 2026, 20:47 UTC

    #1926 description of record for head a065ad9d9dcfc80ce6098076966744e3cd465afb, part 1 of 3 (vknm 155416 applied; replaces nte-zjhcwtfmphxn, nte-3gxqb7jsrymh, nte-cmp3m1j53pkq):

    Card: tsk-44x5grp6fcsq. The maintainer found this on 2026-11-17 (chat 150828). He wanted to move maity-ops-team (plc-340gtr9byqp2, stopped) to his second runner, got placement_exists, and had no way to remove the old placement. Head: a065ad9d9dcfc80ce6098076966744e3cd465afb (main c09b1bff merged in by merge commit 334eb787; main fa298d27 earlier by merge commit bb489ec1). Review A1039 (F1-F4) is addressed at 2ea1d2ac; the delta reviews A1097 (maity-review-codex-001#tqgb) and A1098 (maity-review-agy-003#6mn6) at 52d2f9c9; the delta reviews A1115 (maity-review-codex-001#tqgb) and A1116 (maity-review-agy-003#6mn6) at a065ad9d.

    What was wrong

    On the project's Managed agents page, actions in web/js/placements.js showed Remove only for a foreign placement. An agent's owner who also owned the runner got Stop, Start and Restart, but no Remove. The hub allows the DELETE for more people than that. delete_placement in hub/src/maity_hub/routes/placements.py and the endpoint row in docs/api.md §15.6 allow it for a human who is either:

    • the runner's owner, with any trust (_runner_owner). This includes a members:admin who owns the runner (_has_right).
    • the agent profile's owner (profile_owner).

    The hub also allows it for an agent with agents:propose, but that is not a human's right on this page.

    Change

    web/js/placements.js now draws Remove on every row that mayAct lets the viewer act on, not only on foreign rows. A row passes mayAct when all of these hold:

    • it is active;
    • it is not waiting for consent, either to start or for a change (pending);
    • the viewer owns the runner (ownsRunner: the owner_id from GET /runners, or the hub's logs_hint) or owns the agent (owns: the owner_id the member list gives for the agent).

    So Remove appears on active, non-consent placements whose ownership the view knows. Nobody the hub would refuse gets the button. Three cases are unchanged:

    • Consent rows still offer nothing but the link to their request in the inbox.
    • A placement that creates its agent profile (agent.id null) still shows no actions to its creator unless they own the runner. owns needs an agent id, while the hub falls back to created_by (hub/src/maity_hub/placements.py profile_owner). This gap predates this PR. Follow-up: tsk-t31j72f4bwzm.
    • The confirm text is unchanged and translated in all ten languages: "Remove {name} from this runner? The agent stops there and the placement closes; its owner can place it again on a runner of their own."

    The Runners page's "Agents on" list (#1907) is untouched.

  8. Lotse · Nov 17, 2026, 20:47 UTC

    #1926 description of record for head a065ad9d9dcfc80ce6098076966744e3cd465afb, part 2 of 3 (vknm 155416 applied; replaces nte-zjhcwtfmphxn, nte-3gxqb7jsrymh, nte-cmp3m1j53pkq):

    Docs

    `docs/runners.md`

    • In the Managed agents paragraph, the agent's owner or the runner's owner now "stops and removes" agents there.
    • "To move an agent of yours…" now also covers moving an agent from one of your runners to another. It names Remove under Managed agents, or Remove agent under Runners for a runner of yours.
    • It says a start elsewhere is refused (placement_exists) while the old placement is there. Today an agent has one placement per project; several, one per instance, are in the contract but not built yet.
    • It says what Remove does, without listing states: "Remove closes the placement at once or, while the runner may still be running it, wants it stopped and closes it when the runner reports it stopped. If the row stays and the runner never reports, a second Remove closes it at once. The exact rules are in docs/api.md §15.5 (Closing)." The list shows active placements only. The API also lists closed ones (?closed=true): those closed in the last 30 days, and older ones whose clone is still held. GET …/placements/<id> reads one by its id.
    • `docs/api.md`: §15.5 Closing now states the rule as close_uniform (hub/src/maity_hub/placements.py) and _remove (hub/src/maity_hub/routes/placements.py) apply it. Remove closes at once when approval.status is not approved, when there is no report yet, when the runner has no live credential, or when the last report is terminal and for the current generation (reported_current). Otherwise it sets desired: stopped and closing, and the next accepted terminal report of the current generation closes it. A terminal report of an older generation, for example the last one before a restart or a change of spec, does not close it at once. A DELETE of a placement that is already closing closes it at once, whatever the runner last reported. §15.6 (moving an agent, step 3) and §15.8 (reports) follow that wording.
    • It says the old clone stays on the runner until that runner's owner removes it (maity runner gc --revoked). Removing it once the retention time is up is marked not built yet.

    `docs/humans.md`

    • The Managed agents paragraph says that the runner's owner or the agent's owner can Remove a placement, and what that does. Before, it said this only for a placement made by someone else.
    • It says a placement waiting for consent, to start or for a change, offers none of the actions.

    Test

    The placements section of web/tools/smoke.js. In each case the rows carry the foreign value the hub computes for those owners (foreign is true exactly when the agent profile's owner is not the runner's owner).

    • Own agent on own runner, `foreign: false` (the case of this card). Both rows show Remove and no "placed by someone other than the runner's owner" mark. Remove's aria-label is "Remove Agent B". Remove asks with the text above. A declined confirm sends nothing, and a confirmed Remove is exactly one DELETE /projects/maintainer/maity/placements/plc-0002. With the old foreign-only condition, this case fails (1 failure(s), "removes":[false,false]) and nothing else does.
    • Own runner, another owner's agent, `foreign: true`. A project admin gets the actions, Restart and Remove included (plc-0003).
    • Own agent on another owner's runner, `foreign: true`. Each row shows exactly Stop and Remove, with no Start or Restart.
    • The existing negative cases still offer no actions: a runner someone else owns where the agents are someone else's too, neither owner, and a pending consent row.
  9. Lotse · Nov 17, 2026, 20:47 UTC

    #1926 description of record for head a065ad9d9dcfc80ce6098076966744e3cd465afb, part 3 of 3 (vknm 155416 applied; replaces nte-zjhcwtfmphxn, nte-3gxqb7jsrymh, nte-cmp3m1j53pkq):

    Changelog

    changelog.d/claude003-own-placement-remove.md, ### Fixed. It covers Remove on active placements whose runner is the viewer's, or whose agent the member list names as the viewer's. Consent rows still offer no action.

    What ran

    On a065ad9d, after merging main c09b1bff (#1932) by merge commit 334eb787. #1932 changed web/js/placements.js (the placement_quota refusal in the new-placement form) and web/tools/smoke.js (a quota case in the placements section, and the max_placements field in Project settings). This PR's lines are elsewhere in both files (Remove in actions, and the own-placement cases in the placements section). It merged without conflict, and both sides read correctly together.

    • make -C web check: ran to the end, all sub-tests ok, no make error.
    • make -C web smoke-run LANGUAGE=en_US: smoke.js all ok, notifications-stream PASS, landing-js all ok.
    • make -C hub test with tests/test_contract_text.py tests/test_contract_whole.py (docs/api.md changed): 51 passed.
    • ktw-lint --strict .: 0 error(s), 0 warning(s).
    • ktw-lint --strict web: 0 error(s), 0 warning(s).
    • Changelog: 30 committed fragments at a065ad9d (besides README).
    • git diff --check c09b1bff HEAD: no output.

    make -C web smoke with its slot wrapper could not run here, because the slot directory is read-only in the sandbox. smoke-run is the same run without the wrapper.

    Not run:

    • the full hub suite. The hub code is unchanged; only the contract text tests ran, for the docs/api.md change;
    • the Playwright end-to-end and pseudo browser runs.