Repository navigation
fix(rex): find the session from REX_BLOCK when REX_SESSION is unset - #39
Merged
Merged
Conversation
Since Rex 0.1.0-preview.23 a pane gets REX_BLOCK but no REX_SESSION, so rex.New reported "not in Rex" inside Rex and turned off sending, agent labels and the last-turn scope. Every rex command rexdiff runs accepts a block ID for -s and uses the session that holds it, so fall back to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 1, 2026
Owner
|
Thanks, merging. |
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.
Problem
Since Rex 0.1.0-preview.23, a pane gets
REX_BLOCKandREX_SERVERbut noREX_SESSION.rex.Newreads a missingREX_SESSIONas "outside Rex", so rexdiff running inside Rex shows "not in Rex".scan't send, the agent label is missing, and the last-turn scope never starts.Fix
When
REX_SESSIONis unset,rex.NewusesREX_BLOCKas the session. Rex accepts a block ID for-sand uses the session that holds the block. I ranapi call,session inspectandeventswith a block ID by hand against 0.1.0-preview.25, and the e2e run below covers the rest. Nothing changes whenREX_SESSIONis set.TestNewWithoutSessioncovers a pane that has onlyREX_BLOCK.Testing
go vet,go test -race -count=1,golangci-lintv2.15.0,go fix -diff,go mod tidy -diffand govulncheck are clean.REXDIFF_REX=$(which rex) go test ./test/passes.test/e2e.shagainst Rex 0.1.0-preview.25: all 51 steps pass on this branch. master fails at step 6, "rexdiff opens with the changes and finds the agent".A separate e2e failure
test/e2e.shstops at step 5 on master and on this branch. In a session with no client attached, which is how the script makes its session, preview.25 leavesownerout ofsession.list_blocksandblock inspect. rexdiff doesn't readowner. For the runs above I removedownerfrom the fixtures locally; that change isn't in this PR. I can send it on its own if you want it.Closes #41
🤖 Generated with Claude Code