Repository navigation
agent --quiet: clamp logger to llError so [info] noise stays off the stdout pipe - #244
Conversation
PR #243 wired --quiet through RunSingleTurn (banner, assistant header, tool decoration, token line all suppressed), but LoadConfig + ConnectMCP + Search.Factory still fired LogInfo unconditionally. Replicate / Lambda / curl callers running `pasclaw agent --quiet -m "..."` 2>&1 still saw lines like: [info] web_search disabled: no real provider configured. Set $PASCLAW_BRAVE_API_KEY / $PASCLAW_TAVILY_API_KEY / ... [info] mcp[replicate] cache hit: 29 tool(s) registered, live refresh started before the assistant's reply, polluting the pipeline the same way the banner used to. Fix: in PasClaw.dpr, mirror the existing IsQuietInvocation banner suppression with SetLogLevel(llError) on the same condition. Same chokepoint, same shape, gates the whole logger at the global level instead of trying to chase down every LogInfo callsite (there are many; new ones land each release). llError keeps error-level messages visible. A quiet pipeline that silently swallowed the reason it failed would be worse than one that prints an extra [info] line -- the explicit error trail is how scripts diagnose "no answer + exit 1" without re-running with debug logging. Pin the contract with src/tests/logger_level_quiet_tests.pas: four cases covering the suppression at llError (only Error leaks), the default llInfo baseline (control), the SetLogLevelFromString "error" alias path (operators who set PASCLAW_LOG=error env-side get the same behaviour), and a CurrentLogLevel round-trip (SetLogLevel state is observable). Uses LogBufferSnapshot rather than stderr capture -- the ring buffer mirrors the same level gate, so observing the buffer is equivalent to observing what the user would have seen.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66d15face6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if IsQuietInvocation then | ||
| { --quiet / -q also clamps the logger to error level so the | ||
| [info] / [debug] noise that LoadConfig + ConnectMCP + | ||
| Search.Factory emit during agent startup ("web_search disabled", | ||
| "mcp[<name>] cache hit", color-detect chatter, etc.) doesn't | ||
| pollute the stdout pipeline scripts read. Real errors still | ||
| reach stderr -- a quiet pipeline that silently swallows the | ||
| reason it failed is worse than one that prints an extra | ||
| [info] line. mcp-stdio mode handles its own logging upstream; | ||
| we don't clamp there. } | ||
| SetLogLevel(llError); |
There was a problem hiding this comment.
Apply quiet log clamp after config log level
With pasclaw agent --quiet ..., this clamp is immediately undone in RunRootCommand: after PasClaw.dpr calls SetLogLevel(llError), RunRootCommand always loads config and calls SetLogLevelFromString(Cfg.Gateway.LogLevel), whose default is info (PasClaw.Cmd.Root.pas:226-230, PasClaw.Config.pas:623-628). In the default configuration this restores info logging before LoadConfig/ConnectMCP/search startup runs, so the [info] lines this change is meant to suppress still appear in quiet one-shot output.
Useful? React with 👍 / 👎.
Code review on PR #244 caught a P1: PasClaw.dpr clamps to llError when --quiet is on argv, but RunRootCommand unconditionally followed up with SetLogLevelFromString(Cfg.Gateway.LogLevel), whose default is 'info' (TConfig.Create line 623-628). In the default config the config-driven level immediately undid the dpr clamp before LoadConfig / ConnectMCP / Search.Factory got a chance to fire their LogInfo noise -- which is exactly what --quiet was supposed to suppress. The bug surfaced verbatim in the user's report: $ pasclaw agent --quiet -m "..." 2>&1 | head [info] web_search disabled: ... [info] mcp[replicate] cache hit: 29 tool(s) registered, ... <actual model reply> Fix: in RunRootCommand, mirror PasClaw.dpr's IsQuietInvocation argv scan with a local ArgvHasQuietFlag and skip the SetLogLevelFromString call when it returns True. Three lines duplicated across the two call sites; a shared module wasn't worth the indirection for argv scanning. Pin the regression in logger_level_quiet_tests.pas's new TestRunRootCommandPreservesQuietClamp: locks in BOTH halves of the ordering -- the fix's "skip when quiet" path keeps the clamp intact, AND the simulated "apply unconditionally" path lets LogInfo through (documenting the bug we're guarding against). A future refactor that drops the guard fails this test instead of silently reintroducing the user-facing leak.
Both changelog files were stuck at the 2026-06-10 TUI / background- subagent / session_search / tool-RPC entries. ~7 weeks of merged PRs (#214 through #244) had landed without a corresponding entry in either file -- the git log was the only record of features like the knowledgebase, inbound MCP server mode, checkpoints + /undo, heartbeat daemon, shell backends (local | docker), send_message, promptware defense, Windows shell-output encoding fixes, fs_grep ripgrep optimisations, OpenTelemetry traces, and `pasclaw agent --quiet`. Added (newest first): 2026-06-13 #244 agent --quiet log-level clamp 2026-06-12 #243 dcc64 search path + agent --quiet / -q #242 OpenTelemetry traces (OTLP/HTTP+JSON) #241 fs_grep tier 5+6 (byte walker + Boyer-Moore-Horspool) #240 fs_grep tier 1-4 (deferred hash + skip-dirs + binary sniff + size cap) 2026-06-11 #239 Windows shell output: auto-detect UTF-8 vs OEM #238 Hashline fs_read header mojibake fix (¶ vs ¶) #237 Windows shell output: OEM codepage decode 2026-06-10 #233 Shell backends (local | docker via IShellBackend) #232 Heartbeat daemon + reversible condensation (CCR) #230 send_message tool + condenser families + promptware defense + task-aware MEMORY.md slicing 2026-06-09 #223 /goal Ralph loop + judge model + JSON-aware condenser #222 /undo wired into agent + sample dprojs #221 Checkpoints (auto-snapshot + TUI /undo) #220 mcp catalog: lenient hub projector #219 mcp: SSE / Streamable HTTP / stdio hub transports #218 Inbound MCP server mode #217 onboard: offer to index docs into the knowledgebase #214 Knowledgebase (RAG over operator-curated docs) Skipped from this changelog (build-system / Delphi-fix / FPC-fix PRs visible in the git log but not user-facing features): #215, #216, #224, #225, #226, #227, #228, #229, #231, #234, #236. Both files (README.md and docs/changelog.md) updated with the same entries -- intentional mirror so a reader on either surface sees the same history. Same prose in both; same footnote refs at the bottom. Validated: every [#N] reference in both files has a matching [#N]: URL footnote (no broken links).
The root README.md is 1007 lines covering everything from install
to provider catalog to security to embedding. Useful as a reference,
painful as a landing page. This PR adds /docs/ as a topical tree
that a reader can navigate by topic — README.md is left untouched
so existing GitHub deep-links (README.md#mcp-servers etc.) keep
working.
Pages added:
index:
docs/README.md ← link tree by topic
getting started:
docs/getting-started.md ← install + onboard + first chat
docs/configuration.md ← config.json + env vars + $PASCLAW_HOME
docs/commands.md ← all 27 top-level commands
capabilities:
docs/providers.md ← 19-entry catalog + fallback + caching
docs/tools.md ← built-in tools the model sees
docs/web-search.md ← web_search / web_fetch providers
docs/memory.md ← workspace/memory/ + FTS5 + vector
docs/knowledgebase.md ← pasclaw kb (RAG over docs)
docs/skills.md ← $PASCLAW_HOME/workspace/skills/
docs/sessions.md ← persistence + resume + steering
docs/mcp.md ← MCP servers (stdio + http) + catalog
docs/cron.md ← scheduled tasks
interfaces:
docs/gateway.md ← /v1/chat/completions + /v1/responses
docs/channels.md ← Telegram/Slack/Matrix/IRC/Discord/...
docs/embedding.md ← TPasClawAgent / TPasClawServer
operations:
docs/security.md ← sandbox + denylist + SSRF guard
docs/observability.md ← OpenTelemetry + /v1/stats
docs/troubleshooting.md ← grep-friendly "user sees X, fix Y"
inside pasclaw:
docs/architecture.md ← system overview + agent loop walkthrough
docs/contributing.md ← repo layout + build + test + commit style
docs/changelog.md ← feature-by-feature history
specialised (already there, kept):
docs/c2w.md ← container2wasm browser build
Conventions for these pages:
- Each page is focused on one topic.
- Cross-links are relative (./<topic>.md#<anchor>).
- Source-truth comments at the top of each unit are still the
last word; these pages link to the relevant unit when the
inline comment is the better source.
- The README.md changelog and the new docs/changelog.md
intentionally mirror each other -- when a PR adds a feature
worth surfacing, both files get an entry.
Three pages have no prior source material in the README and were
written fresh: architecture.md (system overview from the inline
unit comments), contributing.md (build conventions, test
conventions, commit style codified from PR history), and
troubleshooting.md (entries mined from PR descriptions where
real-world issues were diagnosed — Windows OEM mojibake from FMXExpress#237,
config rewrite drops diagnostics from FMXExpress#242, [info] leak in --quiet
from FMXExpress#244, etc.).
README.md is byte-identical to main -- intentional. Splitting it
would break deep-links people have to specific sections. The docs/
tree is purely additive.
The README + docs/changelog.md last entry was 2026-06-13 (FMXExpress#244). Five substantial PRs (FMXExpress#314 FMXExpress#315 FMXExpress#316 FMXExpress#317 FMXExpress#318) and ten more feature PRs between them and that entry shipped without changelog entries. This brings both files current through today. Twenty new entries (newest first, matching the existing style): 2026-06-21 FMXExpress#318 Relay pull-worker provider (queue + provider + /v1/relay/* HTTP) 2026-06-20 FMXExpress#317 pasclaw plan + build PLAN.md pickup + build --goal + cog mode FMXExpress#316 Cloudflare AI Gateway provider catalog rows FMXExpress#315 MCP progressive disclosure + tool_search FMXExpress#314 Stock defaults adopt lean-edit shape; fs_grep split-gate 2026-06-18 FMXExpress#312 Web UI workspace.zip export + import FMXExpress#310 Model-callable cron tool FMXExpress#309 FTS5 snippet window widened 24 -> 60 FMXExpress#307 Windows cmd.exe quoting fix 2026-06-17 FMXExpress#306 cog-build honours profile=security sandbox FMXExpress#304 cog-build default profile = max-build FMXExpress#303 cog-build list[Path] outputs + Secret inputs + -q 2026-06-16 FMXExpress#302 cog-build optional workspace_in FMXExpress#300 pasclaw build cmd + cog-build/ predictor (parent feature) FMXExpress#299 Checkpoints zpaq backend + /redo FMXExpress#298 AGENTS.md + pasclaw init + /init FMXExpress#297 tool_choice force-a-specific-tool form FMXExpress#296 Delphi ExtraEnv injection fix FMXExpress#295 KB native PDF ingest 2026-06-15 FMXExpress#292 pasclaw profile diff + bench Skipped per the changelog's stated convention ("Bug fixes and review follow-ups are in the full git log"): FMXExpress#293 cmd/profile dcc64 fix FMXExpress#294 skills_manage gemini empty-enum fix FMXExpress#301 cmd.build dcc64 fix FMXExpress#311 cron dcc64 fix Files updated identically (the docs/changelog.md note at the top says "This file mirrors the changelog section at the top of the root README.md"): M README.md 20 entries + 20 link refs added M docs/changelog.md same The link-ref block at the bottom of each file gained 20 [#NNN] entries keeping the existing one-per-line / sorted-numerically format.
Summary
PR #243 wired
--quietthroughRunSingleTurn(banner, assistant header, tool decoration, token line all suppressed), butLoadConfig+ConnectMCP+Search.Factorystill firedLogInfounconditionally. Replicate / Lambda / curl callers runningpasclaw agent --quiet -m "..."2>&1still saw:before the assistant's reply, polluting the pipeline the same way the banner used to.
Fix
In
PasClaw.dpr, mirror the existingIsQuietInvocationbanner suppression withSetLogLevel(llError)on the same condition. Same chokepoint, same shape — gates the whole logger at the global level instead of chasing down everyLogInfocallsite (there are many; new ones land each release).llErrorkeeps error-level messages visible. A quiet pipeline that silently swallowed the reason it failed would be worse than one that prints an extra[info]line — the explicit error trail is how scripts diagnose "no answer + exit 1" without re-running with debug logging.Test plan
make smoke— greenmake test— 20 PASS markers (one more than before; no regressions)make test-logger-level-quiet— 4 cases:SetLogLevel(llError)suppressesLogDebug/LogInfo/LogWarn, keepsLogErrorllInfoletsLogInfo/LogErrorthrough (control — pins the "without --quiet, you still get info logs")SetLogLevelFromString('error')matchesSetLogLevel(llError)(PASCLAW_LOG=error env path stays in sync)CurrentLogLevelround-trip viaSetLogLevelPASCLAW_HOME=/tmp/xyz ./build/pasclaw agent --quiet -m "test prompt"→ single error line, no[info]noise, exit code 1PASCLAW_HOME=/tmp/xyz ./build/pasclaw agent -m "test prompt"(no flag) → full banner + offline preview + any[info]logs still present (control)Scope
Three files, ~150 LOC, vast majority of which is test + comments. The actual fix is two lines in
PasClaw.dpr.Generated by Claude Code