Skip to content

dcc64: add otel/ to Delphi search path; add pasclaw agent --quiet - #243

Merged
FMXExpress merged 3 commits into
mainfrom
claude/otel-delphi-search-path
Jun 13, 2026
Merged

FMXExpress merged 3 commits into
mainfrom
claude/otel-delphi-search-path

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Two unrelated-but-grouped fixes the user hit running PasClaw on Replicate after PR #242 merged.

1. dcc64 fix: add src/pkg/otel to DCC_UnitSearchPath

PR #242 added src/pkg/otel/PasClaw.Otel.pas and wired it into PasClaw.Config's implementation uses clause, but only the FPC Makefile's UNIT_DIRS got updated. src/pasclaw/PasClaw.dproj kept the pre-#242 search path, so the next dcc64 build of PasClaw.dpr errored:

PasClaw.Config.pas(611): F2613 Unit 'PasClaw.Otel' not found.

Fix: append ..\pkg\otel to DCC_UnitSearchPath, slotted right before ..\pkg\vendor\dmvcframework to match the order the Makefile lists it. No behavioural change; FPC build is already green.

2. pasclaw agent --quiet / -q for machine-readable output

Replicate / Lambda / curl callers running pasclaw agent -m "..." want JUST the assistant's reply on stdout — not the ASCII banner, the assistant (provider/model): header, every per-tool › tool fs_read { ... } / ✓ ... decoration line, or the trailing [tokens in=X out=Y, iters=Z] footer.

Before:

██████╗  █████╗ ███████╗ ██████╗██╗      █████╗ ██╗    ██╗
██╔══██╗██╔══██╗██╔════╝██╔════╝██║     ██╔══██╗██║    ██║
...
assistant (gemini/gemini-3.5-flash):
› tool fs_list { "path" : "/tmp/tmpreb5necq" }
  ✓ - config.json  675
› tool fs_read ...
  ✓ ...
Hello! I am PasClaw, your 10x developer assistant. ...
  [tokens in=9572 out=128, iters=4]

After --quiet:

Hello! I am PasClaw, your 10x developer assistant. ...

Wiring (one new bool propagated through 3 sites):

  • TAgentArgs.Quiet, set by ParseArgs on --quiet or -q.
  • TLoopHandlers.Quiet causes OnToolCall / OnToolResult to no-op, so the loop's per-tool preview lines stay off stdout.
  • RunSingleTurn skips the cyan assistant header, skips MaybeRender (which would re-introduce ANSI styling), and skips the dim token line. The offline-preview branch collapses to a single pasclaw error: ... line so callers still get something on stdout.
  • PasClaw.dpr's IsQuietInvocation scans argv for --quiet / -q before the banner fires, same pattern IsStdioMCPInvocation already uses for pasclaw mcp stdio.

Interactive mode silently ignores Quiet (only makes sense for one-shot -m).

Test plan

  • make smoke — green
  • make test — 19 PASS markers, no failures
  • Manual: PASCLAW_HOME=/tmp/quiet-test ./build/pasclaw agent --quiet -m "test" → single line pasclaw error: provider not configured (...) (no banner, no decorations)
  • Manual: PASCLAW_HOME=/tmp/quiet-test ./build/pasclaw agent -q -m "test" → identical (short flag works)
  • Manual: PASCLAW_HOME=/tmp/quiet-test ./build/pasclaw agent -m "test" (no --quiet) → full banner + offline preview scaffold (control)
  • Operator with real provider: pasclaw agent --quiet --provider anthropic -m "say hi" should print only the assistant text — happy to run if the merge needs validation, just need an API key on the runner

Generated by Claude Code

claude added 2 commits June 13, 2026 04:05
PR #242 added src/pkg/otel/PasClaw.Otel.pas and wired it into
PasClaw.Config's implementation `uses` clause, but only the FPC
Makefile's UNIT_DIRS got updated -- src/pasclaw/PasClaw.dproj kept
the pre-#242 search path, so the next dcc64 build of PasClaw.dpr
errored out the moment it pulled PasClaw.Config in:

  PasClaw.Config.pas(611): F2613 Unit 'PasClaw.Otel' not found.

(Line 611 is the new `PasClaw.Otel` entry in the implementation
uses list -- the file itself exists, dcc64 just didn't know to look
under ..\pkg\otel for it.)

Fix: append `..\pkg\otel` to the DCC_UnitSearchPath, slotted right
before `..\pkg\vendor\dmvcframework` to match the order the
Makefile lists it. Same pattern any other new package directory
follows when added to the build.

No behavioural change. FPC build was already green (Makefile has
src/pkg/otel under UNIT_DIRS since #242); this brings the Delphi
project up to parity.
Replicate / Lambda / curl callers running `pasclaw agent -m "..."`
want JUST the assistant's reply on stdout, not the ASCII banner, the
"assistant (provider/model):" header, every per-tool decoration
line, or the trailing "[tokens in=X out=Y, iters=Z]" footer. The
prior shape forced every script that consumed pasclaw to grep
through this noise to find the actual answer.

  Before (truncated):
    ██████╗  █████╗ ███████╗ ██████╗██╗      █████╗ ██╗    ██╗
    ██╔══██╗██╔══██╗██╔════╝██╔════╝██║     ██╔══██╗██║    ██║
    ...
    assistant (gemini/gemini-3.5-flash):
    › tool fs_list { "path" : "/tmp/tmpreb5necq" }
      ✓ - config.json  675
    › tool fs_read ...
      ✓ ...
    Hello! I am PasClaw, your 10x developer assistant. ...
      [tokens in=9572 out=128, iters=4]

  After --quiet:
    Hello! I am PasClaw, your 10x developer assistant. ...

Wiring (one new bool propagated through 3 sites):

  - TAgentArgs.Quiet, set by ParseArgs on --quiet or -q. Short form
    matches what shells reach for first.
  - TLoopHandlers.Quiet causes OnToolCall / OnToolResult to no-op
    so the loop's per-tool preview lines stay off stdout.
  - RunSingleTurn skips the cyan "assistant (...)" header, skips
    MaybeRender (which would re-introduce ANSI styling), and skips
    the dim token line. The offline-preview branch (no provider
    configured) collapses to a single "pasclaw error: ..." line so
    callers still have something to surface.
  - PasClaw.dpr's IsQuietInvocation scans argv for --quiet / -q
    before the banner fires, same pattern IsStdioMCPInvocation
    already uses for `pasclaw mcp stdio`. Suppressing the banner
    here keeps the dpr's "print before arg parsing" order intact
    -- no refactor needed.

Usage line in the bad-args error path updated to advertise the flag.
Interactive mode silently ignores Quiet (the field is set but
RunInteractive doesn't read it -- the flag only makes sense for
one-shot -m).

Verified by hand against a fresh PASCLAW_HOME with no provider
configured: `pasclaw agent --quiet -m "test prompt"` prints a single
line ("pasclaw error: provider not configured ..."); plain
`pasclaw agent -m "test prompt"` still prints the full banner +
offline-preview / You: / Assistant: scaffold.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fc3330359

ℹ️ 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".

Comment on lines +425 to +430
if A.Quiet then
{ Quiet mode: a single undecorated line so scripts have
SOMETHING on stdout to surface, without the banner-y "(offline
preview)" / "You: ..." mock-conversation rendering. Callers
relying on exit code still see this as a failure path. }
PrintLn('pasclaw error: provider not configured (' + Err + ')')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return failure for quiet provider errors

When pasclaw agent --quiet -m ... runs without a configured provider, this new quiet branch prints an error but then just returns from RunSingleTurn; Cmd_Agent_Run unconditionally sets Result := 0 after the call. That makes scripts using the new machine-readable mode treat provider configuration failures as successful invocations, even though no assistant reply was produced.

Useful? React with 👍 / 👎.

Code review on PR #243 caught that the new --quiet branch in
RunSingleTurn printed the "provider not configured" error then
returned cleanly, so Cmd_Agent_Run still hit its unconditional
Result := 0 below. Scripts using --quiet (Replicate, Lambda, curl
pipelines) would see exit 0 with the error text on stdout and
assume success -- silently masking a config error that produced
no assistant reply.

Fix: convert RunSingleTurn from procedure to function returning
Boolean. False on either failure mode:
  - PickProvider failed (no provider configured)
  - RunToolLoop returned False (mid-turn provider / network /
    cap-iteration failure)

Cmd_Agent_Run maps False -> exit 1. Same for non-quiet mode --
the prior "always exit 0" behaviour was just as wrong there; a
script grepping output was the only signal a turn failed.
Interactive mode keeps the existing behaviour (no return path
worth distinguishing; the session lifecycle is the signal).

Verified by hand against an unconfigured PASCLAW_HOME:
  pasclaw agent --quiet -m "test"  -> stdout = single error line,
                                       exit code = 1
  pasclaw agent          -m "test"  -> stdout = (offline preview)
                                       + You: / Assistant: lines,
                                       exit code = 1
  pasclaw agent --quiet -m "test"   -> exit code = 0 (on a
   (provider configured)              successful turn -- unchanged)
@FMXExpress
FMXExpress merged commit cbf4a91 into main Jun 13, 2026
FMXExpress pushed a commit that referenced this pull request Jun 13, 2026
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).
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Jul 13, 2026
PR FMXExpress#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.
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.

2 participants