Skip to content

feat: ask user how to proceed on network/proxy issues - #1

Open
feng2919013386-oss wants to merge 1 commit into
dkmnx:mainfrom
feng2919013386-oss:feat/network-issue-clarify
Open

feat: ask user how to proceed on network/proxy issues#1
feng2919013386-oss wants to merge 1 commit into
dkmnx:mainfrom
feng2919013386-oss:feat/network-issue-clarify

Conversation

@feng2919013386-oss

Copy link
Copy Markdown

Summary

When a tool call fails with a network, proxy, connectivity, or rate-limit error (timeout, ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET, proxy error, 429, 502/503/504, quota exceeded, certificate issues, ...), the model should stop and ask the user how to proceed instead of silently retrying or switching approaches.

Changes

  • clarify-utils.ts: add NETWORK_ISSUE_PROMPT system-prompt section (injected alongside CLARIFY_PROMPT), NETWORK_ERROR_PATTERN regex, isNetworkIssueResult() detection, and buildNetworkReminderResult() tool-result patch helper
  • index.ts: listen to tool_result — when an errored result matches network/proxy/rate-limit signatures, append a reminder nudging the model to call clarify_prompt with remedy options (retry / switch proxy or network / wait / fallback / skip)
  • index.test.ts: 7 new unit tests (prompt content, detection coverage incl. Chinese error strings, no false positives on unrelated errors, prompt injection, reminder patch shape)
  • README.md: document the new behavior

Behavior

  • Governed by the existing /clarify toggle
  • No-op in RPC/print mode (no interactive UI)
  • Detection requires isError: true to avoid false positives

When a tool call fails with a network, proxy, connectivity, or rate-limit
error (timeout, ECONNREFUSED, ENOTFOUND, ETIMEDOUT, proxy error, 429,
502/503/504, quota exceeded, certificate issues, ...), the model should
stop and ask the user how to proceed instead of silently retrying or
switching approaches.

- Add NETWORK_ISSUE_PROMPT injected alongside CLARIFY_PROMPT into the
  system prompt forbidding silent retries and approach switches
- Detect network/proxy error signatures in failed tool results and append
  a reminder nudging the model to call clarify_prompt with remedy options
  (retry / switch proxy or network / wait / fallback / skip)
- Governed by the existing /clarify toggle; no-op without interactive UI
- Add unit tests for detection and prompt injection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants