fix: remote job stuck after SSH update completes (v0.5.4)

Treat agent_update_state as source of truth for active job; poll log thread no longer overwrites finished status.
This commit is contained in:
PTah
2026-07-08 12:30:14 +10:00
parent 253b80c500
commit 1ad01534f1
3 changed files with 44 additions and 4 deletions
+24
View File
@@ -247,6 +247,30 @@ def test_clear_stale_running_remote_actions(db_session):
assert host.remote_action["ok"] is False
def test_get_remote_action_status_ignores_stale_running_payload(db_session):
from app.services.host_remote_actions import get_remote_action_status
host = Host(
hostname="done-linux",
os_family="linux",
product="ssh-monitor",
agent_update_state="success",
remote_action={
"status": "running",
"message": "Выполняется обновление… (лог с хоста)",
"output": "=== Script update completed successfully ===",
"ok": True,
"finished_at": "2026-07-08T02:21:11+00:00",
},
)
db_session.add(host)
db_session.commit()
status = get_remote_action_status(host)
assert status["active"] is False
assert status["agent_update_state"] == "success"
def test_cancel_host_remote_job_api(jwt_headers, client, db_session):
host = Host(
hostname="cancel-me",