feat: add official Codex skill and harden task execution

Install and update artemis-use with task diagnostics and plugin guidance. Preserve cross-device file receipts, review canonical reports, guard stage transitions and reduce small history summaries. Improve exploration lifecycle, request recovery and browser live connections.
This commit is contained in:
chenmingxuan committed 2026-10-18 14:18:37 +08:00
1 parent 2328a4df0c
commit e1ea099592
128 files changed
+4944 -700

No files matched your search

+12 -4
View File
@@ -62,6 +62,7 @@ from artemis.llm.prefix_cache import PromptPrefixTracker
from artemis.llm.router import ModelEndpoint, ModelFactory, ModelProvider
from artemis.services.token_meter import record_llm_usage
from artemis.llm.usage import usage_from_message
from artemis.llm.stream_guard import ToolArgumentGuard, ToolArgumentOverflow
from artemis.llm.structured import (
ParseFailure,
StructuredOutputError,
@@ -431,6 +432,13 @@ async def _run_with_recovery[T](
max_attempts = (
max_retries + 1 if max_retries is not None else policy.max_attempts
)
if failure.category is FailureCategory.INVALID_OUTPUT:
# One fresh response can recover a generation loop. Repeated
# runaway output must reach the existing fallback/pause path,
# even when ordinary network retries are configured higher.
max_attempts = min(
max_attempts, total_attempts + max(0, policy.max_attempts - attempt)
)
if total_attempts >= max_attempts:
break
delay = policy.delay_for(attempt)
@@ -776,12 +784,14 @@ class RobustChatModelWrapper:
stream_exec_id = uuid4()
full_response = None
argument_guard = ToolArgumentGuard()
try:
async with aclosing(self.base_model.astream(*args, **kwargs)) as stream:
async for chunk in stream:
observation = ACTIVE_ATTEMPT.get()
if observation is not None:
observation.chunk(chunk)
argument_guard.observe(chunk)
if full_response is None:
full_response = chunk
else:
@@ -791,7 +801,7 @@ class RobustChatModelWrapper:
except (KeyboardInterrupt, asyncio.CancelledError):
raise
except Exception as stream_error:
if full_response is not None:
if full_response is not None or isinstance(stream_error, ToolArgumentOverflow):
# Mid-stream failure: the partial output must never reach
# message history. Tell the UI to discard it, then let the
# recovery policy retry the whole call with a fresh stream id.
@@ -806,9 +816,7 @@ class RobustChatModelWrapper:
"reason": "mid_stream_failure",
"error": str(stream_error)[:500],
"category": classify_failure(stream_error).category.value,
"message": (
"A request error occurred during output generation, typically caused by lower API priority. Retrying automatically..."
),
"message": "本次模型输出异常,未完成的输出已丢弃;正在按恢复策略处理。",
},
)
raise