Commit Graph
11 Commits
Author SHA1 Message Date
Martin Njalale dc138b2bf0 Deregister agent job when the server terminates it (#4893)
* Deregister agent job when the server terminates it

JobTerminate ended the job on the worker but left its JobTerminate
handler and jobToWorker entry registered. Those were only cleaned up
when the worker later sent an ended job status, or on worker disconnect
for jobs still running. Workers that do not report job status after a
termination (agents-js never sends UpdateJobStatus) leaked a psrpc
handler for every job terminated by the server, e.g. each time an agent
participant left its room.

* Wait for worker registration in JobTerminate test

The worker's registration response is sent before its job request topic
is registered, so wait for the WorkerRegistered event before requesting
jobs. Also cover a worker reporting an ended status after the server
terminated the job, and clarify the JobTerminate comment.
2026-09-28 05:15:45 -07:00
Paul Wells 1ba2cadccd agent: release JobTerminate handler when job ends before registration (#4908)
* agent: release JobTerminate handler when job ends before registration

JobRequest registered the job's JobTerminate handler after AssignJob
returned, so an ended UpdateJobStatus or worker disconnect handled in
between deregistered nothing and the handler leaked. AssignJob also sent
the assignment before recording the job as running, so an immediate
ended update was dropped.

Record the job before sending the assignment, and after registering the
handler recheck under h.mu that the job is still running and its worker
still registered, deregistering otherwise.

Fixes #4901

* replace utils.CloneProto with proto.CloneOf

* agent: wait on worker readiness and poll for released handlers in test
2026-09-25 00:58:22 -07:00
Felix-Ayush 4618b63eb7 Fix AgentHandler.DrainConnections deadlock on worker close. (#4710)
Snapshot workers and release h.mu before Close so HandleConnection can deregister without blocking drain.
2026-08-03 14:49:23 +05:30
David Zhao 88facc0235 adds a test to ensure agent worker errors cause disconnection (#4273) 2026-01-31 14:19:19 -08:00
Raja Subramanian 2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
cnderrauber 4104b8270b update protocol (#4183)
* update protocol

* fix test
2025-12-22 12:54:11 +08:00
David Zhao 5f561b4ff1 Include agent_name as a participant attribute (#3914) 2025-09-10 21:29:55 -07:00
Paul Wells 8428d5e62b update protocol (#3031)
* update protocol

* test

* cleanup
2024-09-21 17:05:39 -07:00
Paul Wells 61179d5624 simplify agent registration (#3018)
* simplify agent registration

* testutils

* deps

* fix

* gen

* cleanup

* lower job load
2024-09-19 05:58:30 -07:00
Dan McFaul 489f73f0a4 distribute load to agents probabilistically, inversely proportionate to load (#2902)
* select the least loaded agent worker for job dispatch

* update to load balance using inverse load

* remove unused file

* adding unit tests for worker job distribution
2024-08-07 21:05:47 -06:00
Paul Wells 2346c8a6b7 add example agent test (#2914) 2024-08-06 19:51:30 -07:00