Skip to content

Shrink Squid negative DNS TTL to stop caching transient SERVFAILs - #8171

Merged
lpcox merged 4 commits into
mainfrom
copilot/awf-fix-dns-servfail-issue
Sep 5, 2026
Merged

Shrink Squid negative DNS TTL to stop caching transient SERVFAILs#8171
lpcox merged 4 commits into
mainfrom
copilot/awf-fix-dns-servfail-issue

Conversation

Copilot AI commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Firewall Escape Test runs intermittently blocked legitimate api.github.com/github.com traffic (403 or DNS SERVFAIL) despite no actual security escape, recurring across 6 separate runs.

Root cause

Squid's default negative_dns_ttl is 1 minute. A single transient upstream DNS SERVFAIL (e.g. under concurrent container startup or resolver load) gets negatively cached, so every subsequent request for that domain fails for up to 60s — even after the allowlisted domain's DNS has recovered. One flake turns into a sustained false-positive block.

Changes

  • src/squid/config-sections.ts (generateDnsSection): emit two additional directives alongside dns_nameservers:
    • negative_dns_ttl 1 seconds — re-query on the very next lookup instead of replaying a stale failure for up to a minute.
    • dns_timeout 5 seconds — fail a stalled/unresponsive nameserver query fast (down from Squid's 30s default) so it falls through to the next configured nameserver sooner.
  • src/squid/config-sections.test.ts: added coverage for the new directives; switched the DNS section assertion from an exact string match to a regex match since the section now spans multiple lines.
  • samples/audit/squid.conf: updated the static example config to match the generator output.
dns_nameservers 8.8.8.8 8.8.4.4
negative_dns_ttl 1 seconds
dns_timeout 5 seconds

Copilot AI changed the title [WIP] Fix intermittent DNS SERVFAIL for GitHub domains Shrink Squid negative DNS TTL to stop caching transient SERVFAILs Sep 5, 2026
Copilot AI requested a review from lpcox September 5, 2026 15:47
@lpcox
lpcox marked this pull request as ready for review September 5, 2026 16:43
Copilot AI balanced review requested due to automatic review settings September 5, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The five-second timeout prevents fallback to the second nameserver and lacks behavioral regression coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Reduces Squid’s negative DNS caching to improve recovery from transient DNS failures.

Changes:

  • Sets a one-second negative DNS TTL and five-second DNS timeout.
  • Adds generator assertions and updates the sample configuration.
File summaries
File Description
src/squid/config-sections.ts Generates the new DNS directives.
src/squid/config-sections.test.ts Tests directive generation.
samples/audit/squid.conf Updates the example configuration.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread samples/audit/squid.conf Outdated
# DNS settings - Squid resolves all domains for HTTP/HTTPS traffic
dns_nameservers 8.8.8.8 8.8.4.4
negative_dns_ttl 1 seconds
dns_timeout 5 seconds
Comment thread src/squid/config-sections.test.ts Outdated
Comment on lines +192 to +199
it('shrinks negative_dns_ttl to avoid caching a single transient SERVFAIL', () => {
const { dnsSection } = buildWithDefaults();
expect(dnsSection).toMatch(/^negative_dns_ttl 1 seconds$/m);
});

it('lowers dns_timeout so a stalled query fails fast', () => {
const { dnsSection } = buildWithDefaults();
expect(dnsSection).toMatch(/^dns_timeout 5 seconds$/m);
Comment thread src/squid/config-sections.ts Outdated
Comment on lines +214 to +217
# Fail a stalled DNS query quickly (default dns_timeout is 30 seconds) so a
# slow/unresponsive nameserver doesn't stall requests for that long before
# Squid tries the next configured nameserver.
dns_timeout 5 seconds`;
@lpcox

lpcox commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot rebase onto main and address review feedback

Copilot AI added 2 commits September 5, 2026 17:01
…ervfail-issue

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot rebase onto main and address review feedback

Addressed in 100a90c: merged main into the branch, replaced the 5s/5s DNS timeout regression with dns_retransmit_interval 1 seconds plus dns_timeout 10 seconds, added behavioral coverage for fallback resolver retry timing, and updated the audit sample. Validation passed: targeted Jest test, ESLint on touched TS files, TypeScript build, secret scan, and CodeQL.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.99% 94.00% 📈 +0.01%
Statements 92.62% 92.63% ➡️ +0.01%
Functions 93.33% 93.33% ➡️ +0.00%
Branches 86.38% 86.39% 📈 +0.01%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Docker Sbx reports failed. Our correspondents are investigating the incident...

📰 BREAKING: Report filed by Smoke Docker Sbx

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

Generated by Build Test Suite for #8171

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Smoke Claude for #8171

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR #8171 follows the contributing guidelines: it includes tests for the new DNS behavior, updates the sample config documentation, places changes under src/ and samples/ appropriately, and the PR description is clear with a related issue reference. No contribution-guideline issues found.

Generated by Contribution Check for #8171

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

🔮 The oracle has spoken through Smoke Codex

@lpcox
lpcox deployed to aoai-model September 5, 2026 17:35 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini reports failed. Facets need polishing...

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Copilot Network Isolation Smoke Test @lpcox

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable — allowed=200
✅ Blocked domain (example.com) denied — CONNECT tunnel failed, 403

Overall: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results: Copilot BYOK Mode ✅

  • ✅ MCP connectivity (gh API)
  • ✅ HTTP 200 (github.com)
  • ✅ File write/read
  • ✅ BYOK inference (api-proxy → api.githubcopilot.com)

Status: PASS | Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY)

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine

Overall: PASS

cc @lpcox

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@lpcox

  1. GitHub MCP Testing (PR titles: Upgrade gh-aw to latest pre-release, fix: support GPT-6 Astra model): ❌
  2. GitHub.com connectivity: ✅
  3. File I/O test: ✅
  4. BYOK Inference: ✅

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: FAIL

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

  • ❌ Redis PING: Temporary failure in name resolution
  • ❌ PostgreSQL pg_isready: no response
  • ❌ PostgreSQL SELECT 1: Temporary failure in name resolution

Overall: FAILhost.docker.internal DNS resolution failed for all checks; sandbox cannot reach host service containers.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@lpcox
lpcox deployed to aoai-model September 5, 2026 17:41 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color pass ✅ PASS
Go env pass ✅ PASS
Go uuid pass ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Notes:

  • Bun and Deno were installed locally (not present by default).
  • Maven's default ~/.m2/repository was not writable in this sandbox (Permission denied); worked around by passing -Dmaven.repo.local=/tmp/gh-aw/agent/m2repo to mvn compile/mvn test. Both Java projects then compiled and passed successfully. This appears to be a sandbox filesystem permission quirk unrelated to the firewall itself, but is worth noting since the task instructions assume the default ~/.m2 path is writable.
  • All other ecosystems ran with default configuration and no issues.

Generated by Build Test Suite for #8171 · copilot · auto · 35.1 AIC · ⊞ 12K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.14 Python 3.12.14 ✅ YES
Node.js v24.20.0 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: FAILED — Node.js version mismatch between host and chroot environment. smoke-chroot label not applied since not all tests passed.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Upgrade gh-aw to latest pre-release
fix: support GPT-6 Astra model
MCP list PRs: ✅
GitHub.com HTTP: ✅
File write/read: ✅
BYOK inference: ✅
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra
Overall: PASS
@Copilot @lpcox

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

OTel Tracing Smoke Test Results

  • Scenario 1 (Module Loading): otel.js loads successfully; isEnabled()true; exports include startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, plus internal exporter/serialization helpers.
  • Scenario 2 (Test Suite): 68/68 tests passed across 3 suites (otel.test.js, exporters, workload-identity) — covers span creation, gen_ai.usage.* attributes, budget attributes, OTLP/JSON serialization, ProxyAwareOtlpExporter, FileSpanExporter, and shutdown.
  • Scenario 3 (Env Var Forwarding): env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID to the agent; api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, and full trace context to api-proxy.
  • Scenario 4 (Token Tracker Integration): token-tracker-http.js contains the onUsage callback hook point for OTEL.
  • Scenario 5 (OTEL Diagnostics): No live sandboxed run occurred in this validation pass, so no otel.jsonl span file was present to inspect — expected outside an actual awf execution; not a regression.

Summary: All testable scenarios pass. No tracing regression detected.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[awf] squid/dns: recurring intermittent block of allowed GitHub domains + DNS SERVFAIL (6x, not fixed by prior close)

3 participants