Skip to content

samples/agent: fix Codex reviews on merged PRs #95 + #96 - #97

Merged
FMXExpress merged 2 commits into
mainfrom
claude/dcc32-cfg-syntax-fix
May 30, 2026
Merged

FMXExpress merged 2 commits into
mainfrom
claude/dcc32-cfg-syntax-fix

Conversation

@FMXExpress

@FMXExpress FMXExpress commented May 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to merged PRs #95 and #96 — addresses all four Codex findings against them in one branch.

Commit 1 (18568b6): dcc32.cfg / dcc64.cfg syntax — from PR #95 review

# Severity File Finding
1 P1 dcc32.cfg / dcc64.cfg (comment lines) # isn't a valid comment marker in Delphi .cfg files — each non-empty line is fed to the compiler as a command-line argument, so the prose lines were being interpreted as source filenames and rejected before the compiler ever got to the -U / -NS lines below.
2 P1 dcc32.cfg / dcc64.cfg (search-path block) Multiple -U flags don't accumulate — each replaces the previous. With 26 separate -U lines, only the last (..\..\src\pkg\vendor\dmvcframework) survived, so PasClaw.Agent and every other unit was unreachable. The cmdline build couldn't have worked.

Fix: rewrite both .cfg files with documented Embarcadero syntax — a single -U with a quoted, semicolon-separated path list:

-U"..\..\src\cmd;..\..\src\pkg\cliui;...;..\..\src\pkg\vendor\dmvcframework"
-NSSystem;System.Net;System.Win;Xml;Data;Datasnap;Web;Soap;Winapi;Posix
-AWinTypes=Winapi.Windows;WinProcs=Winapi.Windows

Explanatory prose moves to nowhere because it's already in the sample .dpr headers, the sample Makefile, and the README — none of which dcc32 parses.

Commit 2 (009174a): SetProvider model handling — from PR #96 review

# Severity File Finding
3 P2 PasClaw.Agent.pas SetProvider('anthropic', k1) then SetProvider('openai', k2) kept Anthropic's claude-opus-4-7 in FModel. The "belt and suspenders" assignment fired on call 1 (empty FModel → catalog default), then call 2's if (FModel = '') check skipped the update, sending the Anthropic name to the OpenAI endpoint.
4 P2 PasClaw.Agent.pas groq and ollama ship Spec.DefaultModel := '' in PasClaw.Providers.Catalog (Groq routes by deployment, Ollama by local pull). Two-arg SetProvider('groq', k) left TConfig.Create's seed claude-opus-4-7 as DefaultModel, silently sending the wrong model to api.groq.com.

Fixes:

  • Drop the "belt and suspenders" FModel := Override.Model from both TPasClawAgent.SetProvider and TPasClawServer.SetProvider. FModel is reserved for the embedder's explicit choice (Create(model) or Model :=); SetProvider stays out. ChatHistory's fallback to FConfig.DefaultModel (which ApplyProviderOverride always sets) handles the switch correctly.
  • BuildProviderOverride raises EPasClawRun with a clear pointer to the three-arg overload when neither caller nor catalog supplies a model. Two-arg SetProvider for anthropic / openai / etc. (which ship catalog defaults) keeps working; only no-default providers now require the embedder to spell out the model — which they had to anyway.

Verification

=== Test 1: SetProvider must not stick FModel ===
  after anthropic: Agent.Model = ""
  after openai:    Agent.Model = ""
  PASS

=== Test 2: groq w/o explicit model must raise EPasClawRun ===
  PASS: EPasClawRun raised — provider "groq" has no catalog default
  model — pass one explicitly: SetProvider('groq', APIKey, '<model-name>')

=== Test 3: groq WITH explicit model must succeed ===
  PASS

make clean && make smoke 11/11 green. Three sample binaries still build. dcc32 cmdline flow now reaches the same DCC_UnitSearchPath the .dproj files provide via MSBuild (full Delphi validation pending an actual dcc32 install).

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon


Generated by Claude Code

claude added 2 commits May 30, 2026 18:09
Two P1s from Codex on the previous PR landed valid:

  1. Shell-style # comments aren't recognised by dcc32 / dcc64;
     each non-empty line in a .cfg file is fed to the compiler
     as a command-line argument, so the prose lines were being
     interpreted as source filenames and rejected before the
     compiler ever got to the -U / -NS lines below.

  2. Multiple -U flags don't accumulate — each replaces the
     previous. The old cfg had 26 separate -U lines, so only
     the last (..\..\src\pkg\vendor\dmvcframework) survived;
     PasClaw.Agent and every other unit was unreachable.

Fix: rewrite both dcc32.cfg and dcc64.cfg with the documented
Embarcadero syntax — a single -U whose argument is a quoted,
semicolon-separated path list. Three lines total:

    -U"..\..\src\cmd;..\..\src\pkg\cliui;...;..\..\src\pkg\vendor\dmvcframework"
    -NSSystem;System.Net;System.Win;Xml;Data;Datasnap;Web;Soap;Winapi;Posix
    -AWinTypes=Winapi.Windows;WinProcs=Winapi.Windows

The explanatory prose that used to be in the cfg lives in the
sample .dpr file headers, the sample Makefile, and the README
"Embedding in your own app" section — none of which a Delphi
compiler ever parses, so the docs stay intact without breaking
the build.

dcc64.cfg is the byte-for-byte sibling of dcc32.cfg, same fix.

Verified: cd samples/component-console && make clean && make
still produces all three sample binaries (FPC build is
unaffected — cfg files are dcc-only). The dcc32 / dcc64 cmdline
flow now reaches the same DCC_UnitSearchPath the dproj files
provide via MSBuild.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
Two P2 findings from Codex on the merged PR #96, both legitimate:

1. **Cached FModel leaks across provider switches.** The original
   SetProvider had a "belt and suspenders" assignment:

       if (FModel = '') and (FProviderOverride.Model <> '') then
         FModel := FProviderOverride.Model;

   On the first call (e.g. anthropic), FModel was empty so it
   got set to "claude-opus-4-7". On the second call (e.g. openai),
   FModel was no longer empty so the update was skipped — and the
   Anthropic model name got sent to the OpenAI endpoint.

   Fix: drop the assignment entirely. ApplyProviderOverride already
   sets FConfig.DefaultModel, and ChatHistory falls back to it when
   FModel is empty. FModel is reserved for the embedder's EXPLICIT
   choice (constructor or Model property); SetProvider stays out.
   Same fix on TPasClawServer.SetProvider.

2. **Stale TConfig.DefaultModel for catalog entries without a
   default model.** groq and ollama ship Spec.DefaultModel := ''
   in PasClaw.Providers.Catalog (their model name depends on the
   user's deployment / local pull, not a one-size-fits-all). With
   no Model arg and no catalog default, BuildProviderOverride
   produced Result.Model := '', and ApplyProviderOverride's
   `if Override.Model <> ''` guard then SKIPPED updating
   FConfig.DefaultModel — leaving TConfig.Create's seed
   "claude-opus-4-7" in place. Calling
   `Agent.SetProvider('groq', key)` would then try to send
   claude-opus-4-7 to api.groq.com.

   Fix: BuildProviderOverride raises EPasClawRun with a clear
   pointer to the three-arg overload when neither the caller
   nor the catalog supplies a model. Two-arg SetProvider for
   anthropic / openai / etc. (which DO ship catalog defaults)
   keeps working; only the no-default providers now require
   the embedder to spell out the model — which they had to
   anyway for the call to succeed at the API.

Verified with a focused test (built + run, not committed):

    === Test 1: SetProvider must not stick FModel ===
      after anthropic: Agent.Model = ""
      after openai:    Agent.Model = ""
      PASS

    === Test 2: groq w/o explicit model must raise EPasClawRun ===
      PASS: EPasClawRun raised — provider "groq" has no catalog
      default model — pass one explicitly:
      SetProvider('groq', APIKey, '<model-name>')

    === Test 3: groq WITH explicit model must succeed ===
      PASS

`make clean && make smoke` also still 11/11 green.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
@FMXExpress FMXExpress changed the title samples: fix dcc32.cfg / dcc64.cfg — drop # comments, fold -U into one flag samples/agent: fix Codex reviews on merged PRs #95 + #96 May 30, 2026
@FMXExpress
FMXExpress merged commit a35df33 into main May 30, 2026
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