Merge pull request #10555 from SivanCola/codex/fix-restored-tab-lint

refactor(desktop): extract restored tab identity setup / 提取恢复标签身份初始化
This commit is contained in:
SivanCola authored and GitHub committed 2026-09-20 02:41:47 +08:00
commit 31d84501eb
2 files changed
+17 -11

No files matched your search

+2 -11
View File
@@ -785,10 +785,7 @@ func (a *App) restoreOrBuildTabs() {
// goal-state onto the fresh path; reading it here stops a restart
// from re-seeding the cleared goal into the rotated session. A
// session without a sidecar keeps the persisted goal (legacy).
tab.goal = strings.TrimSpace(entry.Goal)
if !entry.restoreBlocked {
tab.goal = runningTabSessionGoal(strings.TrimSpace(entry.SessionPath), tab.goal)
}
restoreRuntime := prepareRestoredTabIdentity(tab, entry)
tab.toolApprovalMode = normalizeToolApprovalMode(entry.ToolApprovalMode)
if tab.toolApprovalMode == control.ToolApprovalAsk && tabModeHasAutoApproveTools(entry.Mode) {
tab.toolApprovalMode = control.ToolApprovalYolo
@@ -798,16 +795,10 @@ func (a *App) restoreOrBuildTabs() {
tab.PendingCreateOperationID = strings.TrimSpace(entry.CreateOperationID)
tab.persistenceExtra = cloneDesktopJSONFields(entry.extra)
tab.ReadOnly = entry.ReadOnly
if entry.restoreBlocked {
tab.StartupErr = "Saved session identity could not be verified. Recovery data was preserved."
tab.retainLegacyPinnedFiles(entry.PinnedFiles)
} else {
restoreTabPinnedContext(tab, entry.PinnedFiles)
}
tab.Takeover.Spectator = entry.TakeoverSpectator
tab.sink = &tabEventSink{tabID: tab.ID, app: a, ctx: ctx}
a.publishRestoredTab(tab, releaseAdmission)
if !entry.restoreBlocked {
if restoreRuntime {
toBuild = append(toBuild, tab)
}
}
+15
View File
@@ -0,0 +1,15 @@
package main
import "strings"
func prepareRestoredTabIdentity(tab *WorkspaceTab, entry desktopTabEntry) bool {
tab.goal = strings.TrimSpace(entry.Goal)
if entry.restoreBlocked {
tab.StartupErr = "Saved session identity could not be verified. Recovery data was preserved."
tab.retainLegacyPinnedFiles(entry.PinnedFiles)
return false
}
tab.goal = runningTabSessionGoal(strings.TrimSpace(entry.SessionPath), tab.goal)
restoreTabPinnedContext(tab, entry.PinnedFiles)
return true
}