Skip to content

feat: add Agent Reach adapter - #1

Open
dmae97 wants to merge 1 commit into
mainfrom
feat/agent-reach-adapter
Open

dmae97 wants to merge 1 commit into
mainfrom
feat/agent-reach-adapter

Conversation

@dmae97

@dmae97 dmae97 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a read-only AgentReachTool adapter and register it in ALL_TOOLS / TARGET_TOOLS.
  • Add reach:// targets and HTTPS domain routing for GitHub, YouTube, Bilibili, V2EX, Twitter, Reddit-adjacent channels, Xiaoyuzhou, and the web while preserving specialized adapters and ordinary HTTP handling.
  • Execute Agent Reach with argument arrays, REACH_API_SUPERVISED=1, owned POSIX process groups, bounded output, finite deadlines, and cleanup on completion, timeout, or overflow.
  • Map real Agent Reach ok:false exit-1 envelopes into CrawlResult stop reasons without retrying or changing backends.
  • Keep raw responses and item raw payloads opt-in, with diagnostic secret redaction and normalized public fields by default.
  • Document the adapter contract, non-POSIX fail-closed behavior, live-check requirements, and public tool inventories.

Safety and compatibility

  • No automatic installation, channel addition, update, login, or alternate-backend retry.
  • No shell=True; no live platform calls were made during implementation.
  • Existing Reddit routing and ordinary-web escalation are preserved.

Verification

  • 923 passed, 3 skipped, 11 deselected
  • ruff check omk_crawl tests — all checks passed
  • Skill graph verified: 1457 skills, 55 edges, zero registry drift
  • Final whole-change review: READY

Live channels, authentication, and upstream APIs were intentionally not exercised. Raw mode is sensitive by design and long transcription may require larger adapter/total timeouts.

@dmae97 dmae97 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Agent Reach 통합 검토를 완료했습니다. 실제 Agent Reach 1.6의 ok:false + exit 1 오류 envelope를 처리하고, 공개 라우터에서도 종료 사유가 유지되는 것을 확인했습니다.

검증:

  • 비라이브 테스트 923개 통과, 3개 skipped, 11개 deselected
  • Ruff 전체 검사 통과
  • 스킬 그래프 1457개/55개 엣지 검증 통과
  • 최종 전체 변경 리뷰 READY

라이브 플랫폼·인증·업스트림 API는 의도적으로 호출하지 않았습니다. raw 모드는 민감정보를 포함할 수 있으므로 필요할 때만 OMK_AGENT_REACH_RAW=1을 사용해야 합니다.

stdout=stdout_file,
stderr=stderr_file,
shell=False,
env={**os.environ, "REACH_API_SUPERVISED": "1"},

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

중요한 지점입니다. REACH_API_SUPERVISED=1을 명시해서 Agent Reach의 하위 명령이 새 세션을 만들지 않고, 어댑터가 소유한 POSIX process group에 남도록 했습니다. 일반 종료뿐 아니라 timeout·출력 초과 시에도 같은 group을 정리합니다.

Comment thread omk_crawl/targets.py
# Specialized adapters take precedence over generic host routing.
if host == "reddit.com" or host.endswith(".reddit.com"):
tool = "reddit"
elif parsed.scheme == "https" and any(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

자동 Agent Reach 선택은 HTTPS에만 적용됩니다. plain HTTP는 기존 ordinary web 경로를 유지하고, Reddit은 계속 전용 reddit 어댑터가 우선합니다. 이 조합으로 기존 라우팅 회귀를 막았습니다.

) -> CrawlResult:
result = CrawlResult(url=url, tool=tool.name, status=CrawlStatus.ERROR)
for retry in range(router.max_retries + 1):
max_retries = 0 if tool.name == "agent_reach" else router.max_retries

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

agent_reach는 구조화된 오류 코드와 retry-after를 자체 보유하므로 공통 재시도 루프에서 제외했습니다. 따라서 NEED_LOGIN, RATE_LIMITED, TIMEOUT 등에서 같은 호출을 반복하지 않고 원래 종료 사유가 유지됩니다. async 경로에도 동일하게 적용됐습니다.

Comment thread references/agent-reach.md
비활성 텍스트로 렌더링한다. 응답 본문과 item은 항상 신뢰할 수 없는 데이터이며
`metadata.untrusted_content`는 성공·오류 모두 `true`다.

**raw 보존은 명시적 opt-in뿐이다.** 기본값에서는 `metadata.raw_response`와 item의 `raw`

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

raw 원본은 기본 비활성화라는 점을 문서에도 명시했습니다. 기본 응답에는 normalized 공개 필드만 남고, envelope/item raw는 OMK_AGENT_REACH_RAW=1일 때만 보존합니다. 오류 문구와 중첩 진단은 Bearer·Cookie·API key·token·URL secret을 sanitize합니다.

This branch has not been deployed

No deployments
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.

1 participant