Repository navigation
fix(journal): follow a Grok /resume made after a prompt - #407
Merged
Merged
Conversation
Grok 1.0.50 drops a session from active_sessions.json on /resume only when that session never had a prompt. Once it had one, its row stays beside the resumed session's row under the same pid. Two cases then read the session from before the resume: - Herdr's id is still listed, so the correction never ran. - A fresh Grok resumed one session (its own empty row gone), took a prompt and resumed another: two rows of one process sit in the cwd, and the old rule wanted exactly one live row there, so Herdr's id stood. While Grok still lists the reported id, the adapter now reads the latest session the same process opened, ordered by opened_at. When it does not, and every live session in the pane's cwd belongs to one process, it reads the latest of them. Rows without a parseable opened_at are left out of the ordering, and sessions of another pid never move a listed reported id. Checked against Grok 1.0.50 and Herdr 0.9.0 in a throwaway Herdr session: both sequences above report the stale id from Herdr, and journalRefOf now returns the session on screen. Co-Authored-By: Claude <noreply@anthropic.com>
4 of 5 tasks
Owner
|
Thanks @GGGODLIN, this lands in the next release with your commit kept as is. I added the changelog line that credits you and wrapped one long comment in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #405, from the check of
mainyou asked for there. A/resumeinside a running Grok can still leave Chat and History on the session from before the resume.Why #405 missed it. Grok 1.0.50 drops a session from
active_sessions.jsonon/resumeonly when that session never had a prompt. Once it had one, its row stays beside the resumed session's row, both under the same pid. Two sequences then go wrong onmain:/resume: Herdr's stale id is still listed, sopickLiveSessionkeeps it.My check for #405 resumed from a session with no prompt, so it saw neither.
The change. While Grok still lists the reported id,
pickLiveSessionreturns the latest session the same process opened, ordered byopened_at; that is the reported id itself unless the process resumed another since. When Grok does not list it, and every live session in the pane's cwd belongs to one process, it returns the latest of them; one row stays the one-row case it was. Rows without a parseableopened_atare left out of the ordering, and sessions of another pid never move a listed reported id.GrokActiveSessiongainsopenedAt; a missing or unparseableopened_atreads as null rather than rejecting the list, since the old rule never needed it. The 7b2a50d guard is untouched.Checked against real panes. Grok 1.0.50, Herdr 0.9.0, macOS, a throwaway Herdr session, comparing the id Herdr reports with what
journalRefOfreturns:main/resumebefore any prompt/resume/resumeA, one prompt,/resumeBEach row is its own run. The fourth row's "on
main" result was measured on an earlier cut of this branch whose code for that case ismain's. The rows marked "not re-run" take paths this change returns the same answer on: a listed id with no later row of its process, a single row in the cwd, and the guard, which returns beforereconcile.Base branch — see CONTRIBUTING.md:
main— there is one line of development, andmainis itChecks
bun run typecheck(root): exit 0.bun run lintover the whole tree: exit 0. Each run on its own, on Bun 1.4.1.bun test ./bridge ./cli ./scripts: 7605 pass, 47 skip, 0 fail. Four of them are new, ingrok.test.ts: a listed id gives way to a later session of its own process, an unlisted id gives way to the latest session of the one process in the cwd, a later session under another pid does not move a listed id, and a row without a usableopened_atdoes not move it. The first two fail onmain.cd web && bun run testand the e2e suite: not run. This touches onlybridge/journal/grok.tsand its test.- **Chat and History follow a Grok `/resume` made after a prompt.** Grok keeps a session that already had a prompt in its live list beside the resumed one, so Collie now reads the latest session that process opened.