mirror of
https://github.com/chenhg5/cc-connect.git
synced 2026-10-26 01:50:40 +08:00
fix(core): resolve permission race condition and update go.sum
- Set state.pending BEFORE sending permission prompt so handlePendingPermission never reads nil when the platform callback fires immediately (fixes flaky TestProcessInteractiveEvents_PermissionWhileSendBlocked under -race) - Update go.sum for BurntSushi/toml v1.6.0 checksum change Made-with: Cursor
This commit is contained in:
1 parent
6cd7faeb9f
commit
b808f62cba
2 files changed
+13
-13
No files matched your search
+12
-12
@@ -2429,18 +2429,6 @@ func (e *Engine) processInteractiveEvents(state *interactiveState, session *Sess
|
||||
"tool", event.ToolName,
|
||||
)
|
||||
|
||||
if isAskQuestion {
|
||||
e.sendAskQuestionPrompt(p, replyCtx, event.Questions, 0)
|
||||
} else {
|
||||
permLimit := e.display.ToolMaxLen
|
||||
if permLimit > 0 {
|
||||
permLimit = permLimit * 8 / 5
|
||||
}
|
||||
toolInput := truncateIf(event.ToolInput, permLimit)
|
||||
prompt := fmt.Sprintf(e.i18n.T(MsgPermissionPrompt), event.ToolName, toolInput)
|
||||
e.sendPermissionPrompt(p, replyCtx, prompt, event.ToolName, toolInput)
|
||||
}
|
||||
|
||||
pending := &pendingPermission{
|
||||
RequestID: event.RequestID,
|
||||
ToolName: event.ToolName,
|
||||
@@ -2453,6 +2441,18 @@ func (e *Engine) processInteractiveEvents(state *interactiveState, session *Sess
|
||||
state.pending = pending
|
||||
state.mu.Unlock()
|
||||
|
||||
if isAskQuestion {
|
||||
e.sendAskQuestionPrompt(p, replyCtx, event.Questions, 0)
|
||||
} else {
|
||||
permLimit := e.display.ToolMaxLen
|
||||
if permLimit > 0 {
|
||||
permLimit = permLimit * 8 / 5
|
||||
}
|
||||
toolInput := truncateIf(event.ToolInput, permLimit)
|
||||
prompt := fmt.Sprintf(e.i18n.T(MsgPermissionPrompt), event.ToolName, toolInput)
|
||||
e.sendPermissionPrompt(p, replyCtx, prompt, event.ToolName, toolInput)
|
||||
}
|
||||
|
||||
// Stop idle timer while waiting for user permission response;
|
||||
// the user may take a long time to decide, and we don't want
|
||||
// the idle timeout to kill the session during that wait.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
|
||||
github.com/BurntSushi/toml v1.6.0 h1:MEaUJLQJKFxTNo0xg+dKyOJA2Nu4O8kPVKuJ/gBiyjc=
|
||||
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
|
||||
Reference in new issue
Block a user