Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .agents/metrics.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
{"timestamp": "2026-08-10T15:12:36Z", "agent": "main", "task": "close out cache pre-warming (Plan 11): prewarm tests, [routing.prewarm] config + CONFIG.md docs, prewarm loop fix", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "DI core prewarm_domains + 6 offline tests; fixed join loop that always waited full 60s OVERALL_TIMEOUT; config.toml + agents-docs/CONFIG.md; full suite 138 green, clippy/fmt clean."}
{"timestamp": "2026-08-11T07:57:58Z", "agent": "main", "task": "review, fix, and merge cache pre-warming PR #570", "skill_used": "do-github-pr-sentinel", "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "Self-review roasted 8 issues; fixed 1-6 + moved config keys out of [routing] (log_level now honored); metrics kept out of product PR; CI green; squash-merged 62ea294."}
{"timestamp": "2026-08-11T08:25:03Z", "agent": "main", "task": "drop unnecessary Sync bound on prewarm_domains (#573)", "skill_used": "do-github-pr-sentinel", "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "Relaxed F bound to Fn+Clone+Send+'static; Sync never exercised (closure cloned per task). cargo test 140 pass, clippy clean; PR #573 squash-merged 72bf164."}
{"timestamp": "2026-08-11T00:00:00Z", "agent": "main", "task": "Implement 7 approved codebase improvements: web XSS href scheme validation, thread user maxChars into providers, visual_resolver urlopen timeouts, wire config.log_level into init_logging, delete inert max_links field, warn on malformed config.toml, refresh plans/README stale statuses", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "All 7 landed; quality_gate.sh, web lint+typecheck, cargo fmt+clippy+test, ruff/black/mypy, web vitest targeted all green"}
{"timestamp": "2026-08-11T01:00:00Z", "agent": "main", "task": "Tier1 correctness: refactor guarded Option unwraps in resolver hot loops, non-panicking shared reqwest client, log Mistral agent cleanup failures, delete dead resolve_with_order + ConfigError::InvalidConfig; Tier2 tests: 7 metrics.rs unit tests, implement broken check_python_cli; config subcommand now prints routing/cache.ttl/rate-limits; refresh plans/03+11 stale statuses", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "quality_gate.sh green; cargo 98 unit + all integration tests pass; clippy/fmt clean; validate_docs 0/0; ruff/black clean"}
{"timestamp": "2026-08-11T02:00:00Z", "agent": "main", "task": "Open items: delete dead provider_decorator.py; wire UI profile into /api/resolve (custom->balanced guard); file-backed RoutingMemory persistence (AUDIT #25) via DO_WDR_ROUTING_MEMORY_PATH + cli default path; 7 persistence tests; parity assessed (exa_mcp_mistral/hedge/deep-research scoped as feature work)", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "quality_gate.sh green; web 176 tests; routing 115 tests incl 7 new persistence; mypy/ruff clean; provider_decorator deleted (0 refs repo-wide)"}
{"timestamp": "2026-08-11T03:00:00Z", "agent": "main", "task": "Next batch: assessed stealth.py (retained - designed FetchTier.STEALTH escalation slot, tested, unreachable); implemented fix_duplicate_links fixer (whole-line dedupe); removed fake fix_python_cli/fix_repo_trees stubs + dispatch; removed dead runSequential/runParallel/RunResult, orphan ToggleChip, legacy loadUiState/saveUiState aliases", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "quality_gate.sh green; web 176 tests; python 872 passed; ruff/mypy clean; validate_docs 0/0; fix_duplicate_links proven via synthetic test"}
{"timestamp": "2026-08-11T04:00:00Z", "agent": "main", "task": "Final cleanup sweep: deleted production-dead web/lib/providers.ts + its test (app uses constants.ts/routing.ts); removed dead get_state() + ResolverState.semantic_cache from scripts/state.py; removed vestigial NEXT_PUBLIC_RESOLVER_URL from .env.example/DEPLOYMENT/help page (unread by code); flagged sync_skill.py (orphan+stale) and models.py methods (tested API) for user decision", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "quality_gate.sh green; web 172 tests (4 removed with dead module); python 872 passed; ruff/mypy 50 files clean; imports verified"}
{"timestamp": "2026-08-11T05:00:00Z", "agent": "main", "task": "Resolved flagged items: FIXED (not deleted) sync_skill.py - made utils-package-aware (syncs scripts/utils/*.py + copies real __init__.py, deletes obsolete flat utils.py); refreshed stale skill copy (18 files + 9 new utils/*), fixed 3 stale skill-family test refs (constants import, cache-hit stub, ftp SSRF assertion); corrected DEPLOYMENT.md I introduced NEXT_PUBLIC_APP_URL to real env vars (RECORDS_*, WEB_RESOLVER_MAX_CHARS, keys), removed vestigial NEXT_PUBLIC_* from .env.example", "skill_used": null, "status": "completed", "tokens_used": 0, "duration_seconds": 0, "notes": "quality_gate green; main 872 + skill 91 + web 172 tests pass; black/rff clean; sync_skill --dry-run 0 pending"}
4 changes: 2 additions & 2 deletions .agents/skills/do-web-doc-resolver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""do-web-doc-resolver: Resolve URLs and queries into LLM-ready markdown."""

from scripts.resolve import resolve, resolve_url, resolve_query, main
from scripts.resolve import resolve, resolve_url, resolve_query

__version__ = "0.1.0"
__all__ = ["resolve", "resolve_url", "resolve_query", "main"]
__all__ = ["resolve", "resolve_url", "resolve_query"]
20 changes: 20 additions & 0 deletions .agents/skills/do-web-doc-resolver/scripts/cache_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
Negative caching logic for the Web Doc Resolver.
"""

import logging
from datetime import datetime, timedelta, timezone

logger = logging.getLogger(__name__)


def should_skip_from_negative_cache(cache, key: str, provider: str) -> bool:
if cache is None:
Expand All @@ -24,6 +27,7 @@ def should_skip_from_negative_cache(cache, key: str, provider: str) -> bool:
dt = dt.replace(tzinfo=timezone.utc)
return dt > datetime.now(timezone.utc)
except Exception:
logger.debug("Failed to parse negative cache expiry: %s", expires_at, exc_info=True)
return False


Expand All @@ -49,3 +53,19 @@ def write_negative_cache(
"metadata": metadata,
}
cache.set(f"neg:{provider}:{key}", entry, expire=ttl_seconds)


def should_skip_from_bot_challenge_cache(
provider: str,
url: str,
bot_challenge_cache: dict[str, set[str]],
) -> bool:
"""Skip plain-fetch providers for URLs known to serve bot challenges."""
from urllib.parse import urlparse

try:
domain = urlparse(url).netloc
return provider in ("direct_fetch",) and domain in bot_challenge_cache.get(provider, set())
except Exception as e:
logger.debug("Bot challenge cache lookup failed for %s: %s", url, e)
return False
18 changes: 18 additions & 0 deletions .agents/skills/do-web-doc-resolver/scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
import os
import typing

from scripts.models import FetchTier

logger = logging.getLogger(__name__)

if typing.TYPE_CHECKING:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Body doesn't contain any code


In most cases, an empty body of for, while or if implies some piece of code is missing.
Such empty block must be either filled or removed.

pass


def _load_config() -> dict[str, typing.Any]:
config_path = os.getenv("DO_WDR_CONFIG") or "config.toml"
Expand Down Expand Up @@ -110,3 +115,16 @@ def _env(
BLOCKED_SCHEMES: set[str] = {"file", "javascript", "data", "vbscript"}

DNS_CACHE_TTL: int = 60

CLEAN_CONTENT: bool = os.environ.get("WDR_CLEAN_CONTENT", "1") != "0"

PROVIDER_TIERS: dict[str, FetchTier] = {
"llms_txt": FetchTier.FREE_STATIC,
"direct_fetch": FetchTier.FREE_DIRECT,
"duckduckgo": FetchTier.FREE_SEARCH,
"jina": FetchTier.PAID_LITE,
"firecrawl": FetchTier.PAID_LITE,
"visual_clip": FetchTier.PAID_LITE,
"stealth": FetchTier.STEALTH,
"mistral_browser": FetchTier.PAID_BROWSER,
}
27 changes: 27 additions & 0 deletions .agents/skills/do-web-doc-resolver/scripts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ErrorType(Enum):
INVALID_RESPONSE = "invalid_response"
SSRF_BLOCKED = "ssrf_blocked"
CONTENT_TOO_LARGE = "content_too_large"
BOT_CHALLENGE = "bot_challenge"
UNKNOWN = "unknown"


Expand Down Expand Up @@ -50,6 +51,18 @@ def max_hops(self) -> int:
return 4


class FetchTier(int, Enum):
"""Escalation cost tier for fetch providers.
Lower = cheaper, always tried first."""

FREE_STATIC = 0 # llms_txt: static text file, zero cost
FREE_DIRECT = 1 # direct_fetch: plain httpx, zero cost
FREE_SEARCH = 2 # duckduckgo: free web search
PAID_LITE = 3 # jina, firecrawl: paid but cheap per-call
STEALTH = 4 # anti-bot bypass tier
PAID_BROWSER = 5 # mistral_browser: paid + JS execution


class ProviderType(Enum):
"""Available providers for resolution."""

Expand All @@ -71,6 +84,7 @@ class ProviderType(Enum):
# New providers
DOCLING = "docling"
OCR = "ocr"
VISUAL_CLIP = "visual_clip"

def is_paid(self) -> bool:
return self in (
Expand All @@ -80,6 +94,7 @@ def is_paid(self) -> bool:
ProviderType.FIRECRAWL,
ProviderType.MISTRAL_WEBSEARCH,
ProviderType.MISTRAL_BROWSER,
ProviderType.VISUAL_CLIP,
)

def is_fast(self) -> bool:
Expand Down Expand Up @@ -179,3 +194,15 @@ class ReadonlyResolverProtocol(Protocol):
"""

def __call__(self) -> ResolvedResult | str | None: ...


__all__ = [
"ErrorType",
"Profile",
"ProviderType",
"ValidationResult",
"ProviderMetric",
"ResolveMetrics",
"ResolvedResult",
"ReadonlyResolverProtocol",
]
Loading
Loading