Skip to content

Anthropic backend + tightened keyword fallback + LLM call hardening#5

Merged
Conalh merged 1 commit into
mainfrom
feat/anthropic-backend-and-scope-tightening
May 21, 2026
Merged

Anthropic backend + tightened keyword fallback + LLM call hardening#5
Conalh merged 1 commit into
mainfrom
feat/anthropic-backend-and-scope-tightening

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 21, 2026

Reopened against main after PR #3 merged (the original PR was auto-closed when its base branch codey/taskbound-action-credibility was deleted on merge).

Adds on top of the now-merged scope-llm slice:

  • Anthropic Messages API as a second LLM backend, auto-routed by model-id prefix (claude-* → Anthropic with prompt caching on the static system prompt; everything else → OpenAI as before). Structured output via forced tool_choice.
  • Tighter keyword fallback in isFileInScope — keywords match path segments (split on / and .), not substring-anywhere. Stops fix header from pulling unrelated paths in.
  • LLM call hardening — 30s AbortSignal.timeout and a 64KiB content-length cap, applied to both backends via a shared callLlm wrapper.

22/22 tests passing (18 prior + 4 new). See closed #4 for full discussion.

Layers on top of the codex slice that landed scope-llm support, PR-body
ingestion, and the .taskbound.yml config. Three independent improvements:

1. Anthropic Messages API as a second LLM scope-extraction backend,
   auto-routed by model-id prefix. 'claude-*' models go to Anthropic
   (with prompt caching on the static system prompt via cache_control
   on the system content block); anything else stays on the existing
   OpenAI Responses backend. Both paths return the same normalized
   InferredScope and share a single normalizeLlmScope helper, so the
   review pipeline doesn't know or care which provider answered.
   Structured output is forced via 'tool_choice: { type: tool, name:
   report_scope }' so the response is always JSON-shaped against the
   shared SCOPE_SCHEMA.

2. isFileInScope keyword fallback was 'substring anywhere in the path,'
   which over-matched: a task saying 'fix header' would pull
   src/auth/header-injection-fix.ts into scope. Now keywords must
   appear as a substring of a path segment (split on '/' and '.'), so
   src/components/Header.tsx and src/styles/header.css still match
   while unrelated files don't.

3. LLM calls now share a callLlm wrapper with a 30-second
   AbortSignal.timeout (a hung Anthropic/OpenAI call cannot hang the
   GitHub Action) and a 64KiB content-length cap (a runaway response
   cannot OOM the runner).

test/scope-anthropic-and-keyword.test.mjs locks the new behavior with
four cases: Anthropic routing+caching, OpenAI regression, Anthropic
failure fallback, and keyword segment-matching. Total suite 22/22 green.
@Conalh Conalh force-pushed the feat/anthropic-backend-and-scope-tightening branch from 839d331 to 01d4b11 Compare May 21, 2026 20:31
@Conalh Conalh merged commit 2addb76 into main May 21, 2026
2 checks passed
@Conalh Conalh deleted the feat/anthropic-backend-and-scope-tightening branch May 21, 2026 20:32
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