You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(company-os): heartbeat resume/terminate routes record the acting user inconsistently #21136
Found in review of PR #21135 (#21119), which makes the budget-policy resume route record the verified caller as approved_by via resolve_principal_id. Two neighbouring heartbeat control routes still record their actor in different ways.
stores the username, not the principal id, in paused_by
The same operation should behave the same way on every route. A pause, resume or terminate should record who did it in one form: the principal id from resolve_principal_id(current_user), the canonical helper in autobot_shared/principal.py. That form should go both in the row and in an audit event.
Acceptance criteria
resume_agent records the verified caller via resolve_principal_id and emits an audit event naming them.
terminate_agent stores the principal id, not the username.
Neither route takes an actor from the request body. A test sends a forged actor in the body and asserts it is ignored.
The pause, resume and terminate routes share one actor-resolution path, with no per-route variants.
Related: #21056 is the pause-overwrite defect in the same controls flow; it is a separate fix.
Closure check, 2026-11-12 (Riga), against merged main. PR #21148 landed via train #21382, merge commit 6199adc. The issue was closed by Closes #21136; all four ACs are now ticked with code evidence, so it stays closed.
AC
Status
Evidence (autobot-backend/)
resume_agent records the verified caller and emits an audit event
Met
api/heartbeat.py:416-417resumer = _actor_id(_user), _audit_control(resumer, AuditAction.AGENT_RESUME, ...); services/audit/taxonomy.py:154AGENT_RESUME; test test_resume_emits_audit_event_naming_caller
terminate_agent stores the principal id, not the username
Met
heartbeat.py:450-455actor = _actor_id(_user), state.paused_by = actor; test test_terminate_stores_principal_id_not_username
No route takes an actor from the body; a forged-actor test
Met
heartbeat.py:324 comment and use of _actor_id(_user); test test_pause_records_principal_and_ignores_forged_body_actor (api/heartbeat_actor_21136_test.py:52). AgentResumeRequest and AgentTerminateRequest carry no actor field (terminate has only reason), so pause is the only route with a forgeable body field
One shared actor-resolution path
Met
_actor_id (heartbeat.py:274, wraps resolve_principal_id) and _audit_control (:280) are used by pause (:325), resume (:416), terminate (:450)
Ticked 4 of 4. Behaviour on a live install is not evidenced: the host still runs pre-update code (#21343). None of the ACs is a host criterion.
Remaining, by design: heartbeat routes are not company-scoped (#21376). Until #21376, paused_by_name (PR #21148) can show a pausing user's display name across companies. Resume has no resumer column; the audit event is the record. Parent link: #21137.
Activity
github-actions commentedon Nov 8, 2026
needs-structurecleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).chore(types): regenerate api.ts for HeartbeatConfigResponse.paused_by…
fix(heartbeat): record control audit durably after commit; show actor…
fix(heartbeat): write the control audit record before the change and …
fix(heartbeat): one accurate paused_by_name description and a route-l…
test(company-os): route-level actor and unauthenticated tests for the…
github-actions commentedon Nov 12, 2026
Landed via the merge train (#21382, merge
6199adcab0) via #21148mrveiss commentedon Nov 12, 2026
Closure check, 2026-11-12 (Riga), against merged main. PR #21148 landed via train #21382, merge commit 6199adc. The issue was closed by
Closes #21136; all four ACs are now ticked with code evidence, so it stays closed.autobot-backend/)resume_agentrecords the verified caller and emits an audit eventapi/heartbeat.py:416-417resumer = _actor_id(_user),_audit_control(resumer, AuditAction.AGENT_RESUME, ...);services/audit/taxonomy.py:154AGENT_RESUME; testtest_resume_emits_audit_event_naming_callerterminate_agentstores the principal id, not the usernameheartbeat.py:450-455actor = _actor_id(_user),state.paused_by = actor; testtest_terminate_stores_principal_id_not_usernameheartbeat.py:324comment and use of_actor_id(_user); testtest_pause_records_principal_and_ignores_forged_body_actor(api/heartbeat_actor_21136_test.py:52).AgentResumeRequestandAgentTerminateRequestcarry no actor field (terminate has onlyreason), so pause is the only route with a forgeable body field_actor_id(heartbeat.py:274, wrapsresolve_principal_id) and_audit_control(:280) are used by pause (:325), resume (:416), terminate (:450)Ticked 4 of 4. Behaviour on a live install is not evidenced: the host still runs pre-update code (#21343). None of the ACs is a host criterion.
Remaining, by design: heartbeat routes are not company-scoped (#21376). Until #21376,
paused_by_name(PR #21148) can show a pausing user's display name across companies. Resume has no resumer column; the audit event is the record. Parent link: #21137.fix(heartbeat): pause, resume and terminate record the verified princ…
fix(heartbeat): regenerate api types (mrveiss#21136)