refactor(agent/G_small): rewrap adjacent string-literal fragments (bytes identical, parity corpus)

This commit is contained in:
Teknium
2026-09-02 19:01:42 -07:00
parent ca5f9f342a
commit c1ae5349ba
4 changed files with 15 additions and 31 deletions
+2 -4
View File
@@ -34,8 +34,7 @@ _REVIEW_GOAL = (
"from the excerpt alone. Produce a full, structured review: what "
"the work does, whether it is correct and complete, concrete "
"defects or risks found (with file/line references where possible), "
"what was verified vs. only read, and a clear final verdict with "
"recommended next steps."
"what was verified vs. only read, and a clear final verdict with recommended next steps."
)
@@ -232,8 +231,7 @@ def format_dispatch_note(result: Dict[str, Any], user_prompt: str = "") -> str:
return (
f"⚖ Review subagent dispatched{model_note}{focus_note} — it is "
f"investigating the last {DEFAULT_CONTEXT_MESSAGES} messages in "
f"the background and its full review will re-enter this "
f"conversation when it finishes."
f"the background and its full review will re-enter this conversation when it finishes."
)
# Synchronous fallback (channels that cannot route async completions).
return (
+8 -17
View File
@@ -26,29 +26,21 @@ _PER_MESSAGE_CHAR_CAP = 2000
_TRANSCRIPT_CHAR_BUDGET = 24000
_FORK_PROMPT = (
"The user asked a quick SIDE question with /btw while the main work "
"continues in the original session.\n"
"Rules:\n"
"The user asked a quick SIDE question with /btw while the main work continues in the original session.\nRules:\n"
"- Answer ONLY the side question, using the conversation above as "
"context. Do not continue, redo, or critique the main task.\n"
"- Do NOT call any tools — they are disabled for this side question. "
"Answer directly in text.\n"
"- If the conversation does not contain enough information to answer, "
"say so plainly instead of guessing.\n"
"- Do NOT call any tools — they are disabled for this side question. Answer directly in text.\n"
"- If the conversation does not contain enough information to answer, say so plainly instead of guessing.\n"
"- Be concise and direct."
)
_ONESHOT_INSTRUCTIONS = (
"You are the same AI assistant that is currently working inside the "
"conversation transcribed below. The user has asked a quick SIDE question "
"with /btw while the main work continues.\n"
"Rules:\n"
"- Answer ONLY the side question. Do not continue, redo, or critique the "
"main task.\n"
"- Use the transcript as your primary context; it is a snapshot and may "
"not include the very latest activity.\n"
"- If the transcript does not contain enough information to answer, say "
"so plainly instead of guessing.\n"
"with /btw while the main work continues.\nRules:\n"
"- Answer ONLY the side question. Do not continue, redo, or critique the main task.\n"
"- Use the transcript as your primary context; it is a snapshot and may not include the very latest activity.\n"
"- If the transcript does not contain enough information to answer, say so plainly instead of guessing.\n"
"- Be concise and direct."
)
@@ -138,8 +130,7 @@ def _answer_via_fork(parent_agent: Any, question: str, history: Optional[List[Di
set(),
deny_msg_fmt=(
"Side question (/btw) denied tool call: {tool_name}. "
"Tools are disabled here — answer directly from the "
"conversation context."
"Tools are disabled here — answer directly from the conversation context."
),
)
snapshot = trim_snapshot_for_fork(history)
+1 -2
View File
@@ -17,8 +17,7 @@ _CA_BUNDLE_ENV_VARS = ("HERMES_CA_BUNDLE", "SSL_CERT_FILE", "REQUESTS_CA_BUNDLE"
_REPAIR_HINT = (
"Repair: run `hermes doctor --fix` (auto-reinstalls certifi), or "
"manually: python -m pip install --force-reinstall certifi openai httpx\n"
"If you configured a custom corporate CA bundle, fix or unset the "
"broken CA bundle environment variable."
"If you configured a custom corporate CA bundle, fix or unset the broken CA bundle environment variable."
)
+4 -8
View File
@@ -45,15 +45,11 @@ def build_thinking_timeout_guidance(
"\n\nThe model's thinking phase exceeded the upstream proxy's "
"idle timeout before the first content token arrived. This is a "
f"known issue with reasoning models (like {label}) behind cloud "
"gateways (NVIDIA NIM, OpenAI, Anthropic, DeepSeek). Workarounds "
"in priority order:\n"
"gateways (NVIDIA NIM, OpenAI, Anthropic, DeepSeek). Workarounds in priority order:\n"
f"1. Set `providers.{provider}.models.{model}.stale_timeout_seconds: 900` "
"in `~/.hermes/config.yaml` to extend the per-call timeout. "
"(Hermes's built-in floor is 600s for known reasoning models — "
"if you still see this after raising, the upstream cap is even "
"shorter.)\n"
"2. Lower `reasoning_budget` or set `reasoning_effort: medium` on this "
"model if the provider supports it.\n"
"3. Use a smaller / faster reasoning model if the task doesn't "
"require deep thinking."
"if you still see this after raising, the upstream cap is even shorter.)\n"
"2. Lower `reasoning_budget` or set `reasoning_effort: medium` on this model if the provider supports it.\n"
"3. Use a smaller / faster reasoning model if the task doesn't require deep thinking."
)