Skip to content

fix(work): headless dispatch prompt must forbid backgrounding verification (no resume mechanism exists) - #438

Merged
getappz merged 10 commits into
masterfrom
task/71
Aug 11, 2026
Merged

fix(work): headless dispatch prompt must forbid backgrounding verification (no resume mechanism exists)#438
getappz merged 10 commits into
masterfrom
task/71

Conversation

@getappz

@getappz getappz commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Committed. Changed build_prompt in src/cli/work.rs to explicitly tell headless-dispatched agents that their session is one-shot with no resume mechanism, so build/test/lint commands must run synchronously in the foreground rather than backgrounded — addressing the pattern confirmed in items #68 and #70 where agents backgrounded verification and lost the result when their turn ended. Added a test covering the new instruction; all 6 build_prompt tests pass and the binary builds cleanly.

Summary by CodeRabbit

  • Bug Fixes

    • Improved one-shot headless runs by ensuring build, test, and lint commands execute visibly and complete before the run proceeds.
  • Tests

    • Added coverage to verify that these execution instructions are included.

Items #68 and #70 both hit the same failure: a headless-dispatched agent
ran cargo build/check as a background task and ended its turn saying it
would report back once it finished -- but one-shot headless dispatch has
no mechanism to resume a session, so the harness kills the background
task and the work goes unverified. build_prompt now explicitly tells the
agent this is a one-shot run with no resume path and to run all
verification synchronously in the foreground before ending its turn.

Agentflare-Agent: claude-code
Agentflare-Branch: task/71
Agentflare-Item: 71
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15f370f9-2589-4264-a086-3aafcd176986

📥 Commits

Reviewing files that changed from the base of the PR and between b6d7a8b and a57a5cb.

📒 Files selected for processing (1)
  • src/cli/work.rs
📝 Walkthrough

Walkthrough

The one-shot agent prompt now requires build, test, and lint commands to run synchronously in the foreground. A regression test verifies these instructions and the lack of session resumption.

Changes

Headless verification guidance

Layer / File(s) Summary
Prompt guidance and regression coverage
src/cli/work.rs
build_prompt now requires foreground build, test, and lint commands during one-shot runs. The regression test checks these instructions and the session resumption guidance.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: rust

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the headless dispatch prompt fix and the specific issue with backgrounded verification.
Description check ✅ Passed The description clearly explains the change and reports test results, but it omits the template headings and detailed test plan.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/71

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli/work.rs`:
- Around line 793-806: Extend build_prompt_forbids_backgrounding_verification to
assert that the generated prompt requires verification to run synchronously in
the foreground and requires waiting for completion. Preserve the existing
assertions and use the exact prompt phrases established by build_prompt for both
requirements.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 94e4f8be-e28f-414c-9241-691e6dee53fd

📥 Commits

Reviewing files that changed from the base of the PR and between 9c05039 and b6d7a8b.

📒 Files selected for processing (1)
  • src/cli/work.rs

Comment thread src/cli/work.rs
Comment on lines +793 to +806
#[test]
fn build_prompt_forbids_backgrounding_verification() {
// Items #68 and #70: a headless-dispatched agent ran `cargo build`
// as a background task and ended its turn saying it would report
// back once it finished -- but one-shot headless dispatch has no
// mechanism to resume the session, so the harness kills the
// background task and the verification result is lost. The prompt
// must tell the agent explicitly to run checks synchronously.
let item = test_item();
let prompt = build_prompt(&item, &[]);
assert!(prompt.contains("one-shot headless run"));
assert!(prompt.contains("no mechanism to resume"));
assert!(prompt.contains("Never run build, test, or lint commands as a background task"));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the complete foreground-execution requirement.

The prompt also requires verification to run synchronously in the foreground and to wait for completion. This test does not assert either requirement. Add assertions for both phrases so the test protects the full one-shot execution contract.

Suggested assertions
         assert!(prompt.contains("Never run build, test, or lint commands as a background task"));
+        assert!(prompt.contains("synchronously in the foreground"));
+        assert!(prompt.contains("wait for it to complete"));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[test]
fn build_prompt_forbids_backgrounding_verification() {
// Items #68 and #70: a headless-dispatched agent ran `cargo build`
// as a background task and ended its turn saying it would report
// back once it finished -- but one-shot headless dispatch has no
// mechanism to resume the session, so the harness kills the
// background task and the verification result is lost. The prompt
// must tell the agent explicitly to run checks synchronously.
let item = test_item();
let prompt = build_prompt(&item, &[]);
assert!(prompt.contains("one-shot headless run"));
assert!(prompt.contains("no mechanism to resume"));
assert!(prompt.contains("Never run build, test, or lint commands as a background task"));
}
#[test]
fn build_prompt_forbids_backgrounding_verification() {
// Items `#68` and `#70`: a headless-dispatched agent ran `cargo build`
// as a background task and ended its turn saying it would report
// back once it finished -- but one-shot headless dispatch has no
// mechanism to resume the session, so the harness kills the
// background task and the verification result is lost. The prompt
// must tell the agent explicitly to run checks synchronously.
let item = test_item();
let prompt = build_prompt(&item, &[]);
assert!(prompt.contains("one-shot headless run"));
assert!(prompt.contains("no mechanism to resume"));
assert!(prompt.contains("Never run build, test, or lint commands as a background task"));
assert!(prompt.contains("synchronously in the foreground"));
assert!(prompt.contains("wait for it to complete"));
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/work.rs` around lines 793 - 806, Extend
build_prompt_forbids_backgrounding_verification to assert that the generated
prompt requires verification to run synchronously in the foreground and requires
waiting for completion. Preserve the existing assertions and use the exact
prompt phrases established by build_prompt for both requirements.

getappz added a commit that referenced this pull request Aug 10, 2026
…roviders (item #438)

Three more openai_compatible registry entries, picked for coding use:
siliconflow (Qwen3-Coder-480B, DeepSeek-V3.2/R1, permanently free after
identity verification), llm7 (Qwen2.5-Coder-32B, DeepSeek-R1, no-cost
daily tier), requesty (300+ model router, cleanest ToS rating of the
free aggregators surveyed).

base_url values verified against each provider's own docs (SiliconFlow
quickstart, LLM7 live /v1/models endpoint, Requesty gateway docs), not
guessed. Extended broad_openai_compatible_providers_are_present_and_resolve
to cover all three.

11/11 flare-proxy registry tests pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438
getappz added a commit that referenced this pull request Aug 10, 2026
…(item #438)

New optional RegistrySpec fields -- free_type, monthly_tokens,
credit_tokens -- record each provider's documented free-tier budget:
recurring-daily/monthly (renews), recurring-uncapped (rate-limited, no
token cap), one-time-initial (signup credit), or unmetered (local).
Populated for all 21 providers with a documented free tier; omitted for
paid-key/pass-through providers (openai, xai, together's paid tier,
perplexity, moonshot, anthropic, cf_gateway_*) with no free-tier data.

Data pulled from OmniRoute's freeModelCatalog.data.ts (pool-deduped to
each provider's max), not estimated -- source noted in the TOML header.

Metadata only: no selection/load-balancing logic reads these fields yet.
That's the natural follow-up once this shape has been used for a bit,
scoped separately per plan.

New test (every_registry_free_type_is_a_known_value) catches a typo'd
free_type value against a known set. 12/12 flare-proxy registry tests
pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438
getappz added a commit that referenced this pull request Aug 10, 2026
…tem #438)

New providers::quota module: tracks per-provider token consumption
against the free_type/monthly_tokens/credit_tokens registry metadata
added in the previous commit, and picks the first available provider
from a priority-ordered candidate list.

Design ported (not copied) from two real implementations, researched
and cloned locally for reference:
- LiteLLM's provider budget limiter (BerriAI/litellm, MIT,
  litellm/router_strategy/budget_limiter.py) -- the get-or-init window
  start / reset-if-expired / increment-if-current three-way branch,
  without its Redis multi-instance sync (flare-proxy is one process).
- OmniRoute's emergency fallback (diegosouzapw/OmniRoute, MIT,
  open-sse/services/emergencyFallback.ts) -- fail-open on tracking
  errors, walk a short ordered candidate list rather than re-rank a
  large pool.

Usage persists to flare-proxy-usage.json next to the existing registry
cache (agentflare_home(), now pub(super) for quota.rs to reuse rather
than duplicating the home-dir helper).

Scope boundary, called out in the module doc: this is the tracking/
selection primitive only, not wired into forward.rs's request path yet.
ProviderConfig/ModelRoute resolve to exactly one provider per request
today; using select_best for real routing needs a candidate list there,
and record_consumption needs a real token count, which the streaming
response path doesn't currently extract. Both are separate design
decisions, tracked as the next item #438 follow-up rather than bolted
on here unreviewed.

7 new tests (budget exhaustion, window expiry reset, one-time credits
never resetting, priority-ordered fallback selection). 87/87 flare-proxy
tests pass (stable across repeated runs -- fixed a test-isolation race
by reusing crate::test_env_lock() instead of a module-local mutex, since
AGENTFLARE_HOME_OVERRIDE is a process-global env var shared with
registry.rs's own tests). clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438
getappz added a commit that referenced this pull request Aug 11, 2026
…ini/Cloudflare AI Gateway support (#439)

* feat(flare-proxy): provider registry with native Anthropic/Gemini, zero new deps (item #438)

Replaces the hardcoded 3-provider ProviderKind match (NvidiaNim/OpenRouter/
LmStudio) with a small provider-kind registry: OpenAiCompatible (covers
NVIDIA NIM, OpenRouter, LM Studio, and any future OpenAI-compatible
endpoint via config alone), Anthropic, and Gemini.

Patterns vendored (not depended on) from litellm-rust (avivsinai, MIT) --
see items #436 (rig-core, rejected: streaming not raw-JSON-shaped) and
#437 (litellm-rs rejected for dependency weight; litellm-rust's design is
the reference). Zero new Cargo.toml/Cargo.lock entries: reuses reqwest/
serde_json/futures already in flare-proxy instead of importing an SSE
macro crate, an error crate, or a trait-object abstraction.

- providers/openai_compat.rs: header/auth wiring only -- request/response
  translation stays shape_xlat's existing Anthropic<->OpenAI logic.
- providers/anthropic.rs: near-passthrough. Since flare-proxy's own wire
  format already IS Anthropic Messages, native Anthropic upstream needs no
  shape_xlat at all -- forward.rs proxies the byte stream unchanged.
- providers/gemini.rs: new Anthropic<->Gemini translator, scoped to text +
  tool_calls (no image/audio/video/file parts -- out of scope for this
  proxy's actual traffic). New shape_xlat::gemini_chunk_to_anthropic_sse /
  gemini_finish_stream read Gemini's candidates[0].content.parts shape
  instead of OpenAI's choices[0].delta.

forward.rs restructured to dispatch per ProviderKind before body
translation (each upstream needs a different request shape and URL path,
not just different headers), with a shared stream_translated_sse() helper
for the two paths that do need chunk-by-chunk translation.

65/65 tests pass, clippy clean (-A unsafe_code -A clippy::pedantic),
fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* feat(flare-proxy): Cloudflare AI Gateway support via cf_gateway_anthropic/cf_gateway_openai (item #438)

Cloudflare AI Gateway is a URL prefix in front of a provider's own wire
protocol, not a distinct protocol -- gateway.ai.cloudflare.com/v1/{acct}/
{gw}/anthropic still speaks Anthropic's real Messages API shape,
.../compat still speaks OpenAI's /chat/completions shape. So this needed
no new ProviderKind: just two new provider prefixes whose base_url is
built from CF_AI_GATEWAY_ACCOUNT_ID/CF_AI_GATEWAY_ID, reusing the
Anthropic and OpenAiCompatible paths added earlier in this item unchanged.

cf-aig-authorization (Cloudflare's own gateway-level auth, separate from
the underlying provider's API key) is optional, set from
CF_AI_GATEWAY_TOKEN via the extra_headers mechanism already added for
OpenRouter. Missing CF_AI_GATEWAY_ACCOUNT_ID/ID fails fast to
default_free() at startup rather than shipping an unusable base_url.

Closes the Cloudflare AI Gateway gap identified earlier this session
(flare-proxy previously had zero Cloudflare support of any kind).

68/68 tests pass, clippy clean, fmt clean. Zero new dependencies (single
file changed).

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* refactor(flare-proxy): registry.toml-driven providers, no more hardcoded match arms (item #438)

Per appz-cli's registry/toolchains.toml pattern (crates/appz-core/src/
toolchain_registry.rs) -- scoped down to just what flare-proxy needs: no
HTTP-fetch-with-cache-TTL layer, just an embedded TOML file (include_str!)
parsed once via OnceLock. Adding a provider -- another OpenAI-compatible
endpoint, another Cloudflare AI Gateway route -- is now a
registry/providers.toml edit, not a Rust change.

providers/registry.rs owns the load/lookup/resolve logic:
- RegistrySpec mirrors ProviderEntry's shape (prefix, id, kind, base_url,
  api_key_env, extra_headers) plus two fields the hardcoded version didn't
  need: base_url_template ({ENV_VAR} placeholders, for Cloudflare's
  per-user account_id/gateway_id) and gateway_auth_env/gateway_auth_header
  (an extra header sourced from an env var, distinct from the provider's
  own api_key_env -- Cloudflare's cf-aig-authorization).
- resolve() returns None when a template references an unset env var, so
  from_env()'s existing 'fail fast to default_free()' behavior is
  preserved without each provider needing its own bespoke resolver
  function (deleted cloudflare_gateway_base_url/_headers and
  openrouter_headers -- all three are now registry.toml entries).

default_free() now also builds its 3 built-in providers by resolving them
out of the same registry, instead of duplicating base_url/api_key_env/
extra_headers as separate hardcoded ProviderEntry literals -- one source
of truth for provider identity, whether reached via MODEL=... or the
zero-config default path.

toml crate added to flare-proxy's Cargo.toml -- already a workspace
dependency (root Cargo.toml), so this adds zero new entries to
Cargo.lock.

74/74 tests pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* feat(flare-proxy): download the provider registry on demand, not just embed it (item #438)

The embedded-only registry.toml from the previous commit still required a
new agentflare release to add a provider -- it was baked into the binary
at compile time. This closes that gap the same way appz-cli's toolchain
registry does (crates/appz-core/src/{toolchain_registry,registry_cache}.rs),
scoped down to flare-proxy's single call site: no offline-mode CLI flag,
no generic <T> cache helper, since there's nothing else to share it with.

registry() -- used by find()/resolve()/known_prefixes(), and by this
module's own tests -- reads only the embedded TOML plus whatever's
already cached on disk. It never touches the network, so it stays fast
and deterministic in cargo test (77 tests in 0.02s, unchanged from
before this commit).

ensure_fresh() is the explicit 'download on demand' step: called once
from router() before the first ProviderConfig::from_env() read, it
checks the local cache (~/.agentflare/flare-proxy-providers-registry.json)
against a 24h TTL and, if stale, attempts one 3s-timeout live fetch of
registry/providers.toml's latest published version, merging remote
entries over the embedded ones by prefix. Any failure -- offline, DNS,
non-2xx, malformed TOML -- silently falls back to the embedded copy;
existing installs never break because of a network hiccup, they just
don't get the newest provider until the next successful refresh.

dirs and ureq added to flare-proxy's Cargo.toml -- both already
workspace dependencies via the main agentflare crate, so this adds zero
new entries to Cargo.lock (confirmed via diff).

77/77 tests pass, clippy clean (including a result_large_err fix --
ureq::Error is >270 bytes, fetch_remote() now maps to a plain String
error immediately, matching appz-cli's own Result<String, String>
convention for the same kind of fetch function), fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* data(flare-proxy): populate registry with the broader OpenAI-compatible provider set (item #438)

Adds 17 more openai_compatible entries alongside the original NVIDIA NIM/
OpenRouter/LM Studio/Cloudflare-Gateway set: OpenAI itself, DeepSeek, Groq,
Mistral, xAI, Together, Perplexity, Fireworks, DeepInfra, Moonshot,
Novita, Hyperbolic, Cerebras, SambaNova, GitHub Models, Cohere
(compatibility API), and local Ollama.

base_url values are each provider's own documented OpenAI-SDK-compatible
endpoint as of this session -- best-effort from public docs/conventions,
not individually live-verified against every provider's current docs
given how many there are. Flagged as such directly in the TOML file. If
one drifts, that's exactly what the on-demand refresh added in the
previous commit exists to fix -- correcting registry/providers.toml
upstream reaches every existing install on its next refresh, no new
release needed.

Two new regression tests: every_registry_entry_has_a_resolvable_static_or_
gateway_url (catches a future copy-paste mistake -- a provider block
missing both base_url and base_url_template -- at test time instead of a
confusing request-time 'no route' error) and
broad_openai_compatible_providers_are_present_and_resolve (locks in that
all 17 new prefixes parse, resolve, and produce a well-formed URL).

79/79 tests pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* data(flare-proxy): add siliconflow, llm7, requesty free-tier coding providers (item #438)

Three more openai_compatible registry entries, picked for coding use:
siliconflow (Qwen3-Coder-480B, DeepSeek-V3.2/R1, permanently free after
identity verification), llm7 (Qwen2.5-Coder-32B, DeepSeek-R1, no-cost
daily tier), requesty (300+ model router, cleanest ToS rating of the
free aggregators surveyed).

base_url values verified against each provider's own docs (SiliconFlow
quickstart, LLM7 live /v1/models endpoint, Requesty gateway docs), not
guessed. Extended broad_openai_compatible_providers_are_present_and_resolve
to cover all three.

11/11 flare-proxy registry tests pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* data(flare-proxy): add free-tier quota metadata to provider registry (item #438)

New optional RegistrySpec fields -- free_type, monthly_tokens,
credit_tokens -- record each provider's documented free-tier budget:
recurring-daily/monthly (renews), recurring-uncapped (rate-limited, no
token cap), one-time-initial (signup credit), or unmetered (local).
Populated for all 21 providers with a documented free tier; omitted for
paid-key/pass-through providers (openai, xai, together's paid tier,
perplexity, moonshot, anthropic, cf_gateway_*) with no free-tier data.

Data pulled from OmniRoute's freeModelCatalog.data.ts (pool-deduped to
each provider's max), not estimated -- source noted in the TOML header.

Metadata only: no selection/load-balancing logic reads these fields yet.
That's the natural follow-up once this shape has been used for a bit,
scoped separately per plan.

New test (every_registry_free_type_is_a_known_value) catches a typo'd
free_type value against a known set. 12/12 flare-proxy registry tests
pass, clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* feat(flare-proxy): free-tier usage tracking and fallback selection (item #438)

New providers::quota module: tracks per-provider token consumption
against the free_type/monthly_tokens/credit_tokens registry metadata
added in the previous commit, and picks the first available provider
from a priority-ordered candidate list.

Design ported (not copied) from two real implementations, researched
and cloned locally for reference:
- LiteLLM's provider budget limiter (BerriAI/litellm, MIT,
  litellm/router_strategy/budget_limiter.py) -- the get-or-init window
  start / reset-if-expired / increment-if-current three-way branch,
  without its Redis multi-instance sync (flare-proxy is one process).
- OmniRoute's emergency fallback (diegosouzapw/OmniRoute, MIT,
  open-sse/services/emergencyFallback.ts) -- fail-open on tracking
  errors, walk a short ordered candidate list rather than re-rank a
  large pool.

Usage persists to flare-proxy-usage.json next to the existing registry
cache (agentflare_home(), now pub(super) for quota.rs to reuse rather
than duplicating the home-dir helper).

Scope boundary, called out in the module doc: this is the tracking/
selection primitive only, not wired into forward.rs's request path yet.
ProviderConfig/ModelRoute resolve to exactly one provider per request
today; using select_best for real routing needs a candidate list there,
and record_consumption needs a real token count, which the streaming
response path doesn't currently extract. Both are separate design
decisions, tracked as the next item #438 follow-up rather than bolted
on here unreviewed.

7 new tests (budget exhaustion, window expiry reset, one-time credits
never resetting, priority-ordered fallback selection). 87/87 flare-proxy
tests pass (stable across repeated runs -- fixed a test-isolation race
by reusing crate::test_env_lock() instead of a module-local mutex, since
AGENTFLARE_HOME_OVERRIDE is a process-global env var shared with
registry.rs's own tests). clippy clean, fmt clean.

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438

* fix(flare-proxy): address CodeRabbit findings on PR #439

- forward.rs: apply provider.extra_headers on the Anthropic/Gemini paths too, not just OpenAI-compat -- Cloudflare AI Gateway's cf-aig-authorization was silently dropped for cf_gateway_anthropic
- mod.rs: from_env() route construction now resolves MODEL prefixes (e.g. nvidia_nim) to their registry id (nvidia-nim) before storing provider_id, fixing a 400 "unknown provider" for any prefix whose id differs from its prefix
- gemini.rs: recursively strip JSON-Schema fields Gemini's function-calling API rejects ($schema, etc.) from tool input_schema before sending
- shape_xlat.rs: gemini_finish_stream now reports stop_reason "tool_use" whenever a tool block was opened, even when Gemini's finishReason is "STOP" (its common case for a turn containing a functionCall)
- registry.rs: merge() no longer lets a remote/cached registry entry override an existing provider's base_url/api_key_env, only its quota metadata -- a compromised publish path could otherwise redirect API traffic to an attacker host
- providers.toml: remove github_models -- GitHub retired the Models inference endpoint (410)
- registry.rs: add the missing test_env_lock() guard to resolve_template_substitutes_multiple_placeholders
- Cargo.toml: drop ureq's unused json feature
- forward.rs: remove a dead strip_think_tags() call whose result was discarded

Agentflare-Agent: claude-code_2-1-225_agent
Agentflare-Branch: task/438
Agentflare-Item: 438
getappz pushed a commit that referenced this pull request Aug 11, 2026
Confirmed 5 occurrences (PRs #436/#438/#441/#443 twice) of the identical
signature: a different test each time, always the run's last one to
complete, killed at exactly slow-timeout's 300s boundary while 2100+
other tests pass. This PR's own kill_tree hardening still hit the same
signature on yet another test afterward, ruling out that specific leak
as the sole cause -- reads as generic Windows-runner tail-of-run resource
contention, not a broken test. retries = 2 is nextest's own targeted
mitigation for exactly this shape of flake: a genuinely hung/broken test
fails every retry too, so this doesn't mask real regressions.

Agentflare-Agent: claude-code
Agentflare-Branch: task/78
Agentflare-Item: 78
getappz added a commit that referenced this pull request Aug 11, 2026
… leak detection (#443)

* fix(windows): harden kill_tree against taskkill's tree-kill race, add leak detection

taskkill /T /F builds its process-tree kill list from a single point-in-time
snapshot; a grandchild spawned in the narrow window between that snapshot and
termination can survive undetected, and none of the three Windows kill paths
(agent_launch::kill_tree, flare-git-core::kill_tree, agentflare-jobs's
kill_graceful) ever verified the tree was actually gone before returning.
This is the leading suspect for item #78's recurring Windows CI last-test
slow-timeout: two kill-focused tests always run right before the eventual
timeout, and one of them (timeout_kills_long_running_process) kills a 30s
grandchild with no buffer to let a leak self-correct, unlike its sibling test.

Add a second delayed taskkill /T /F pass to each Windows kill path as cheap
defense-in-depth against the snapshot race, and strengthen both suspect
tests to poll for surviving processes on Windows so a future regression
fails loudly and locally instead of starving an unrelated test downstream.

Agentflare-Agent: claude-code
Agentflare-Branch: task/78
Agentflare-Item: 78

* ci: retry flaky Windows nextest failures instead of failing the run

Confirmed 5 occurrences (PRs #436/#438/#441/#443 twice) of the identical
signature: a different test each time, always the run's last one to
complete, killed at exactly slow-timeout's 300s boundary while 2100+
other tests pass. This PR's own kill_tree hardening still hit the same
signature on yet another test afterward, ruling out that specific leak
as the sole cause -- reads as generic Windows-runner tail-of-run resource
contention, not a broken test. retries = 2 is nextest's own targeted
mitigation for exactly this shape of flake: a genuinely hung/broken test
fails every retry too, so this doesn't mask real regressions.

Agentflare-Agent: claude-code
Agentflare-Branch: task/78
Agentflare-Item: 78

---------

Co-authored-by: shiva <shiva@gosysinfo.tech>
getappz and others added 8 commits August 11, 2026 14:40
…meter

The merge from master (which landed #448's build_prompt(item, comments,
latest_handoff) signature change) merged cleanly at the text level but
left this test's call site on the old 2-arg form, breaking the build.

Agentflare-Agent: claude-code
Agentflare-Branch: task/71
Agentflare-Item: 71
@getappz
getappz merged commit a2b7b41 into master Aug 11, 2026
16 checks passed
@getappz
getappz deleted the task/71 branch August 11, 2026 10:28
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