🐛 fix(vscode): 状态分层读侧补漏——四处 handler 改走 readIssueState 叠加本地状态
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
|||||||
removeDependency,
|
removeDependency,
|
||||||
} from '../../gitea/api'
|
} from '../../gitea/api'
|
||||||
import { isValidSpxFilePath, loadIssues } from '../../gitea/issueLoader'
|
import { isValidSpxFilePath, loadIssues } from '../../gitea/issueLoader'
|
||||||
import { mergeStateJsonComment, readStateJsonComment } from '../../gitea/stateJson'
|
import { mergeStateJsonComment } from '../../gitea/stateJson'
|
||||||
import { logger } from '../../logging/logger'
|
import { logger } from '../../logging/logger'
|
||||||
import { getSettings } from '../../settings/store'
|
import { getSettings } from '../../settings/store'
|
||||||
import { webhookCoordinator } from '../../webhook/coordinator'
|
import { webhookCoordinator } from '../../webhook/coordinator'
|
||||||
@@ -100,7 +100,7 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 读最新 state JSON(从尾往前找已知字段,避免普通评论盖住 branch)。
|
// 1. 读工单状态(共享评论叠加本机 workspaceState 记录)。
|
||||||
let prStr: string | undefined
|
let prStr: string | undefined
|
||||||
let worktreePath: string | undefined
|
let worktreePath: string | undefined
|
||||||
let fromColumn: IssueColumn | undefined
|
let fromColumn: IssueColumn | undefined
|
||||||
@@ -108,13 +108,7 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
|||||||
let testSessionId: string | undefined
|
let testSessionId: string | undefined
|
||||||
let featureBranchFromState: string | undefined
|
let featureBranchFromState: string | undefined
|
||||||
try {
|
try {
|
||||||
const stateObj = await readStateJsonComment({
|
const stateObj = await panel.readIssueState(issueNumber)
|
||||||
host: remote.host,
|
|
||||||
token,
|
|
||||||
owner: remote.owner,
|
|
||||||
repo: remote.repo,
|
|
||||||
issueNumber,
|
|
||||||
})
|
|
||||||
if (typeof stateObj.pr === 'string' && stateObj.pr.length > 0)
|
if (typeof stateObj.pr === 'string' && stateObj.pr.length > 0)
|
||||||
prStr = stateObj.pr
|
prStr = stateObj.pr
|
||||||
if (typeof stateObj.worktreePath === 'string' && stateObj.worktreePath.length > 0)
|
if (typeof stateObj.worktreePath === 'string' && stateObj.worktreePath.length > 0)
|
||||||
@@ -563,10 +557,10 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
|||||||
/**
|
/**
|
||||||
* Handle a "drag to in-progress" kanban move.
|
* Handle a "drag to in-progress" kanban move.
|
||||||
*
|
*
|
||||||
* Validates the issue has a valid `planFile` recorded in its state JSON,
|
* Validates the issue has a valid `planFile` recorded in its state,
|
||||||
* and that the file actually exists on disk, then delegates the full
|
* and that the file actually exists on disk, then delegates the full
|
||||||
* implementation pipeline to `handleImplement` (which owns issue locking,
|
* implementation pipeline to `handleImplement` (which owns issue locking,
|
||||||
* tab reuse, state JSON column/branch/worktreePath writes, gitea webhook
|
* tab reuse, column/branch/worktreePath state writes, gitea webhook
|
||||||
* registration, cc spawn). On any pre-flight failure, rolls the optimistic
|
* registration, cc spawn). On any pre-flight failure, rolls the optimistic
|
||||||
* column move back to the source column.
|
* column move back to the source column.
|
||||||
*/
|
*/
|
||||||
@@ -621,17 +615,11 @@ export async function handleDropToInProgress(panel: KanbanWebviewPanel, issueNum
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read latest state JSON to obtain source column + planFile + optional
|
// 读工单状态(共享评论叠加本机记录)拿 source column + planFile +
|
||||||
// profilePath / sessionId.
|
// 可选的 profilePath / sessionId。
|
||||||
let stateObj: Record<string, unknown> = {}
|
let stateObj: Record<string, unknown> = {}
|
||||||
try {
|
try {
|
||||||
stateObj = await readStateJsonComment({
|
stateObj = await panel.readIssueState(issueNumber)
|
||||||
host: remote.host,
|
|
||||||
owner: remote.owner,
|
|
||||||
repo: remote.repo,
|
|
||||||
token,
|
|
||||||
issueNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
const message = err instanceof Error ? err.message : String(err)
|
const message = err instanceof Error ? err.message : String(err)
|
||||||
@@ -695,8 +683,8 @@ export async function handleDropToInProgress(panel: KanbanWebviewPanel, issueNum
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const profilePath = typeof stateObj.profilePath === 'string' ? stateObj.profilePath : undefined
|
const profilePath = typeof stateObj.profilePath === 'string' && stateObj.profilePath.length > 0 ? stateObj.profilePath : undefined
|
||||||
const sessionId = typeof stateObj.sessionId === 'string' ? stateObj.sessionId : undefined
|
const sessionId = typeof stateObj.sessionId === 'string' && stateObj.sessionId.length > 0 ? stateObj.sessionId : undefined
|
||||||
try {
|
try {
|
||||||
await panel.handleImplement(issueNumber, planFile, profilePath, sessionId)
|
await panel.handleImplement(issueNumber, planFile, profilePath, sessionId)
|
||||||
}
|
}
|
||||||
@@ -864,16 +852,10 @@ export async function handleDeleteIssue(panel: KanbanWebviewPanel, issueNumber:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 读 state JSON 拿 pr / branch / worktreePath
|
// 3. 读工单状态(共享评论叠加本机记录)拿 pr / branch / worktreePath
|
||||||
let stateObj: Record<string, unknown> = {}
|
let stateObj: Record<string, unknown> = {}
|
||||||
try {
|
try {
|
||||||
stateObj = await readStateJsonComment({
|
stateObj = await panel.readIssueState(issueNumber)
|
||||||
host: remote.host,
|
|
||||||
owner: remote.owner,
|
|
||||||
repo: remote.repo,
|
|
||||||
token,
|
|
||||||
issueNumber,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
const message = err instanceof Error ? err.message : String(err)
|
const message = err instanceof Error ? err.message : String(err)
|
||||||
@@ -1945,13 +1927,7 @@ export async function handleGeneratePrDiffSummary(panel: KanbanWebviewPanel, iss
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const state = await readStateJsonComment({
|
const state = await panel.readIssueState(issueNumber)
|
||||||
host: remote.host,
|
|
||||||
owner: remote.owner,
|
|
||||||
repo: remote.repo,
|
|
||||||
token,
|
|
||||||
issueNumber,
|
|
||||||
})
|
|
||||||
const pr = typeof state.pr === 'string' && /^\d+$/.test(state.pr) ? state.pr : undefined
|
const pr = typeof state.pr === 'string' && /^\d+$/.test(state.pr) ? state.pr : undefined
|
||||||
if (!pr) {
|
if (!pr) {
|
||||||
panel.postMessage({
|
panel.postMessage({
|
||||||
|
|||||||
Reference in New Issue
Block a user