Stopping a shared Grok leader is a file check. The kill command on this build prints a success count and exits 0 while the process is still alive. After the process is gone, the JSON list is still not empty. The row that remains names the lock file. Deleting that file is what makes the list empty.
That split is what a restart script has to close. A zero exit from kill is the count being printed. It is not a clear home. A non-empty list after the process has exited is not a second leader. It is the lock the first leader left behind.
What this run started
The binary was Grok Build 1.0.67, build 2fe064390d07, on Linux x86_64, on 23 November 2026. The SHA-256 of that executable was ce33b1a29e37901f56fe59916cda7a1149e6fd377118f918e90d89f9abb52a51. Each case used a new home directory and a new grok home, and set GROK_DISABLE_AUTOUPDATER so the updater was not part of the result. No grok login was run. No prompt was sent. No model turn was started. The operator grok home was not one of the directories under test.
Leaders were started with grok agent leader, with –no-auto-update and –relay-on-demand. One comparison added –no-exit-on-disconnect. That flag’s help says the leader keeps running after the last client disconnects. It does not say the flag changes kill. No interactive client was started, and none was attached.
The changelog page fetched the same evening lists 1.0.89 as the latest build, dated 17 November 2026. grok update –version installs into the active install, so this run did not invoke it. The notes below are 1.0.67 only.
The list and kill help on this binary says the default socket is ~/.grok/leader.sock, and that a custom socket should be named ~/.grok/leader-*.sock so list and kill can find it. Any other location, the same paragraph says, works but will not be auto-discovered. Those sentences are the contract this run checked. They do not say which stream the count is printed on, what remains on disk after a successful kill, or that passing –leader-socket to list fails to see a listening socket whose name misses the pattern.
When GROK_HOME was set to an absolute directory, a leader started with no socket flag bound leader.sock in that directory and wrote leader.lock beside it. It did not create a .grok directory under the case home. The help text’s ~/.grok is the path when GROK_HOME is unset. With the variable set, both the default bind and the scan root moved. A script that isolates config with GROK_HOME and then looks for the socket under the home directory’s .grok will not find the process this start created.
The count is ahead of the process
Without the hold flag, kill wrote nothing on standard output and printed two lines on standard error. The first named the PID and said it was killing that leader. The second was Killed 1 leader process(es). The exit status was 0. On that run the two lines were 58 bytes, which included a 7-digit PID. The byte count will move if the PID has a different width. The sentences will not.
One second later the process was still alive. grok leader list –json at that moment still carried the PID in pid and in pidFromLock. pidLive was null. classification was Stale. socketPath was null. The socket file was already gone. Stale, on this build, does not mean the PID has exited. It means the list could not confirm a live leader on the socket. The lock still held the PID, and the process still answered kill -0.
A second kill, issued while that PID was still alive, printed the same two lines and the same count of 1. It did not say the first kill had already been counted. After the process had exited, the lock file remained and its size was 0 bytes. While the process held it, the file had been 7 bytes, the PID and a newline.
With –no-exit-on-disconnect the kill text was the same two lines, and the exit status was again 0. The timing was slower, and it was measured in one-second steps. At 0 seconds and at 1 second the process was alive and the socket file was still present. At 2 seconds the process was alive and the socket was gone. At 3 seconds the process was dead. The lock remained. A second kill, issued after that death, did not print the killing line. It printed No live leader processes found. on standard error, 32 bytes including the newline, and exited 0. The lock was still there, still 0 bytes.
The hold flag changes how long the process outlives the socket. It does not change the success line, and it does not change the leftover file. On this build the process was still alive at 1 second in both starts. Without the flag it was dead by 2 seconds in the earlier timing run. With the flag it was dead at 3 seconds and alive at 2. Wait until kill -0 fails, then look at the list.
An empty list is a missing file
After the process was dead, grok leader list –json was one object, not an empty array. classification was Stale. pid, pidFromLock, pidLive, and socketPath were null. lockPath named leader.lock in the grok home. wsUrlSuffix was an empty string. Deleting that file made the next JSON list an empty array. The text list then printed No leader candidates found. on standard output, 28 bytes including the newline, and wrote nothing on standard error. Both states exited 0. The empty sentence and the stale row are not separated by the exit code.
A second kill is not a substitute for deleting the file. After the hold-flag process had died, the second kill said no live leader was found and left the 0-byte lock in place. The following JSON list was the same stale object.
A hand-written lock is enough to produce that row. No leader was started for this case. Four files were placed in a new grok home. leader.lock and leader-probe.lock each held the digits 999999 and a newline, 7 bytes. leader-bad.lock held not-a-pid and a newline, 10 bytes. other.lock held the same 7 bytes as the first file. The JSON list had three objects. other.lock was not one of them. The numeric locks carried pid 999999. The lock whose contents were not a PID carried a null pid. Every listed object had classification Stale and a null socket path. wsUrlSuffix was empty for leader.lock, -probe for leader-probe.lock, and -bad for leader-bad.lock.
That suffix is the filename after the literal leader. It is not a URL the process advertised, and no process was running. A reader who appends wsUrlSuffix to a WebSocket address will invent a path from a lock name. The text list put three lines on standard error and left standard output empty. Each line ended in a question mark where a socket path would have been. One line used a question mark for the PID as well, the row whose lock was not numeric. The question marks hide the lock path that JSON still has. A person reading only the text cannot see which file to delete. Use the JSON for that.
Listing did not remove the files. After the command, all four locks were still on disk, including the other.lock file the list had ignored.
A listening socket the scan skips
A leader started with –leader-socket pointed at other.sock inside the grok home did create that socket, and it wrote other.lock beside it. The process stayed alive. A local connect to the socket succeeded. grok leader list –json was an empty array. The same command with –leader-socket pointed at that socket was also an empty array. The text form, with the flag, printed No leader candidates found. on standard output and wrote nothing on standard error. The flag did not override the scan. It did not report the listening socket.
The help text says a custom path works and will not be auto-discovered, and that naming it under the leader- star pattern is what keeps list and kill able to find it. The first half of that advice did not hold for list. Passing the path was not enough. The name had to match the pattern before list would admit the socket existed.
A name that does match was visible. leader-a.sock and leader-b.sock, started in one grok home, both appeared in one JSON array as Reachable, with pidLive set to each process. That case used the hold flag. The discovery result does not depend on explaining kill. The glob in the help text is real for those names, and it is real for the unsuffixed leader.sock that a flagless start binds.
The flag is not a filter. In a home that already had an unreachable leader.sock and a live leader-probe.sock, list with the flag pointed at the probe socket still printed both rows. It also does not see a name outside the pattern.
A socket path outside the grok home did not get as far as a missed listing. grok agent leader with –leader-socket pointed at a leader-out.sock outside that home stayed alive for 6 seconds, then exited. Standard error was one line: Error: Timeout waiting for IPC socket to be created. The outside directory contained leader-out.lock and no socket. The help text’s claim that any other location works was not what this start did. The lock it left is not in the grok home, so a later list of that home will not name it. Delete the outside lock yourself. Kill, pointed at the grok home, will not see it.
Where the lines are printed
Live text rows from list are on standard error. For a single default socket, standard output was empty and standard error was the PID line. Exit status was 0. The JSON for that same leader was on standard output, and standard error was empty. The empty-home text sentence is the other way around from the live text: No leader candidates found. is on standard output. A pipeline that reads only standard output will see the empty sentence when nothing matches, and will see an empty stream when a leader is up. Both exits are 0. The presence of a leader is the standard error line, or the JSON array, not the exit status.
grok leader info does not use that split. Its human form and its JSON form were both on standard output. Kill puts the count on standard error and leaves standard output empty, so a pipeline that reads only standard output of kill sees an empty success either way. Read standard error for the human lines. Read standard output only from the JSON flag.
Reachable with pidLive set means the process answered. Stale with a lockPath and a null socket means a file remains, and the PID in the lock may still be running. An empty array means the scan found no matching socket and no matching lock. It does not mean other.sock is absent. This run had a listening other.sock in a home whose JSON list was empty.
Verify the home is clear
Use a grok home you created for the test. This run set GROK_HOME to an absolute directory that was not the operator home, and set HOME to a different new directory. Confirm the binary before you start anything.
grok --version
On this host that printed grok 1.0.67 (2fe064390d07). Then start the leader only if you need a process to stop.
grok agent leader --no-auto-update --relay-on-demand
Wait until leader.sock exists in the grok home. Then list it.
grok leader list --json
Require one object, classification Reachable, pidLive equal to the process, and socketPath ending in leader.sock. Then kill.
grok leader kill
Require exit 0 and the standard error line Killed 1 leader process(es). Do not require the process to be gone in that same second. Wait until kill -0 on that PID fails. On this build that was 2 seconds without –no-exit-on-disconnect and 3 seconds with it. Then list again.
grok leader list --json
If the array is not empty, read lockPath. On this build it was leader.lock in the grok home, 0 bytes, and the classification was Stale. Remove that file. If you also created leader- star locks, remove the ones lockPath names. Do not treat other.lock as part of this scan. This run did not need to delete it for the list to go empty, because the list had never included it. List again. Require an empty array. The text command should then print No leader candidates found. on standard output.
If you need a side socket, name it leader-side.sock under the same grok home. other.sock was listening and absent from the list, including when the flag named it. A path outside the grok home timed out at about 6 seconds, printed the IPC timeout line, and left a lock with no socket. After that failure, delete the outside lock. The grok-home list will not mention it.
Do not point this check at a grok home that already has sessions, credentials, or a leader you did not start. Kill stops every leader the scan can see in that home. This run used a new home each time. A second kill after the process is dead prints No live leader processes found. and still leaves the lock.
The measured boundary is the leader process, the socket, and the lock. It is not a signed-in session, not an MCP server, and not a model turn. No client was attached after the leader came up. A leader that already has clients was not measured. After the process is gone, require an empty JSON list, and delete the lock if the list still names it.
Sources
- Grok Build 1.0.67, build 2fe064390d07, SHA-256 ce33b1a29e37901f56fe59916cda7a1149e6fd377118f918e90d89f9abb52a51, Linux x86_64, 23 November 2026. Each case used a new HOME and a new GROK_HOME. GROK_DISABLE_AUTOUPDATER was set. No grok login, no prompt, no model turn. grok agent leader was started with –no-auto-update and –relay-on-demand. One comparison added –no-exit-on-disconnect. grok leader kill exited 0 and printed Killed 1 leader process(es). on standard error while the process was still alive at 1 second. After the process exited, grok leader list –json was a Stale object naming leader.lock until that file was removed, after which the JSON list was an empty array.
- grok leader list –help, grok leader kill –help, grok leader info –help, and grok agent leader –help on that binary. The list and kill help says the default socket is ~/.grok/leader.sock and that ~/.grok/leader-*.sock is what list and kill auto-discover. It says any other location works but will not be auto-discovered. It does not say the human list rows are on standard error, that kill leaves a 0-byte lock, or that –leader-socket misses a listening other.sock.
- Grok Build changelog, fetched 23 November 2026: https://x.ai/changelog/build. The page listed 1.0.89 on 17 November 2026 as the latest build. This run did not install that version, and it does not describe it.