Repository navigation
fix(orchestrator): prioritize real thread CWD in workspace selection and read renamed SQLite thread names - #912
Merged
kxn merged 1 commit intoSep 11, 2026
Conversation
…and read renamed SQLite thread names
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.
Summary
This PR addresses two critical issues where sessions (specifically renamed sessions like
/rename svmnew0910or sessions under active workspaces likesvmpy) fail to display properly in/useand/listtarget pickers:SQLite Renamed Threads (
threads.name) Support:/renameupdates thethreads.namecolumn while leavingthreads.titleas the initial long prompt summary.internal/codexstate/sqlite_threads.gopreviously only queriedtitle, resulting in renamed sessions retaining their old generated names.COALESCE(NULLIF(name, ''), title) AS title.Managed Headless Pool Workspace Key Contamination Fix:
~/.local/state/codex-remote), receiving anEventThreadsSnapshotpreviously overwrote unrelated thread records'WorkspaceKeyto the headless instance's workspace root.threadBelongsToInstanceWorkspaceandthreadWorkspaceKeyFromRecord) previously prioritizedthread.WorkspaceKeyoverthread.CWD, causing sessions located in workspaces likesvmpyto be filtered out (0/50 matching) whenever their key was contaminated.EventThreadsSnapshotto avoid contaminating thread workspace keys with unrelated instance roots.threadBelongsToInstanceWorkspaceandthreadWorkspaceKeyFromRecordto prioritize the thread's real physicalCWDand detect cross-workspace hierarchy mismatches.Changes
internal/codexstate/sqlite_threads.go:namecolumn onthreadstable viaPRAGMA table_info.titlewhennamedoes not exist.TestSQLiteThreadCatalogPrefersRenamedNameColumn.internal/core/orchestrator/service.go:CWDworkspace mapping inEventThreadsSnapshotwhen!cwdBelongsToInstanceWorkspace(inst, thread.CWD).internal/core/orchestrator/service_surface_selection.go:thread.CWDover potentially contaminatedWorkspaceKeyinthreadBelongsToInstanceWorkspace.internal/core/orchestrator/service_thread_global.go:threadWorkspaceKeyFromRecordagainstthread.CWDhierarchy.internal/core/orchestrator/service_target_picker_polluted_workspace_test.go:docs/implemented/headless-pool-workspace-thread-selection-fix.md&docs/README.md:Verification
go test -v ./internal/codexstate -run TestSQLiteThreadCatalogPrefersRenamedNameColumn(PASS)go test -v ./internal/core/orchestrator -run "TestTargetPickerSessionOptionsIncludesThreadsWithCrossInstancePollutedWorkspaceKey|TestEventThreadsSnapshotDoesNotPolluteThreadWorkspaceKeyFromUnrelatedInstance"(PASS)bash scripts/check/pre-commit.sh(PASS)