Offer a session once when two project folders hold it, and never crash on a repeat
Resuming a Claude Code session from a different working directory makes the CLI write a second transcript with the same id under that directory's project folder. This machine has one: 160 KB under `-home-bob-repos-tdep-survey` and a 614-byte stub under `-home-bob-repos-tdep`. Everything downstream addresses a session by id -- `--resume` takes it, the delete glob resolves it, the in-flight registry is keyed on it -- so two rows sharing an id are two rows no operation can tell apart, and the phone keys its list on it, so scrolling to them closed the app on Compose's duplicate-key throw. The listing now keeps the copy with the most in it. Size rather than recency, because the stub is often the newer of the two, and picking it describes the session by the wrong size, the wrong cwd and the wrong title. Deleting removes every copy rather than stopping at the first, which had left the row to come back on the next listing after a delete that reported success. The phone's half is `uniqueItems`: every list keyed on a server-chosen id goes through it, since none of them could rule the repeat out locally and a data problem must not be able to close the app. Verified both ways against the real duplicate -- the unguarded build reproduces the reported stack on the same id, the guarded one scrolls the whole list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8257030280
commit
7a8811aab3
7 files changed
+124
-11
No files matched your search
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
@@ -83,7 +82,7 @@ fun SetupsScreen(settings: ServerSettings, reloadToken: Int) {
|
||||
is LoadState.Error -> Text(current.message, color = MaterialTheme.colorScheme.error)
|
||||
is LoadState.Loaded ->
|
||||
LazyColumn(Modifier.fillMaxSize()) {
|
||||
items(current.value, key = { it.id }) { setup ->
|
||||
uniqueItems(current.value, key = { it.id }) { setup ->
|
||||
SetupCard(
|
||||
setup = setup,
|
||||
onRename = { renaming = setup },
|
||||
|
||||
Reference in new issue
Block a user