Repository navigation
samples/agent: fix Codex reviews on merged PRs #95 + #96 - #97
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 reviewdcc32.cfg/dcc64.cfg(comment lines)#isn't a valid comment marker in Delphi.cfgfiles — 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/-NSlines below.dcc32.cfg/dcc64.cfg(search-path block)-Uflags don't accumulate — each replaces the previous. With 26 separate-Ulines, only the last (..\..\src\pkg\vendor\dmvcframework) survived, soPasClaw.Agentand every other unit was unreachable. The cmdline build couldn't have worked.Fix: rewrite both
.cfgfiles with documented Embarcadero syntax — a single-Uwith a quoted, semicolon-separated path list:Explanatory prose moves to nowhere because it's already in the sample
.dprheaders, the sampleMakefile, and the README — none of which dcc32 parses.Commit 2 (
009174a): SetProvider model handling — from PR #96 reviewPasClaw.Agent.pasSetProvider('anthropic', k1)thenSetProvider('openai', k2)kept Anthropic'sclaude-opus-4-7inFModel. The "belt and suspenders" assignment fired on call 1 (empty FModel → catalog default), then call 2'sif (FModel = '')check skipped the update, sending the Anthropic name to the OpenAI endpoint.PasClaw.Agent.pasgroqandollamashipSpec.DefaultModel := ''inPasClaw.Providers.Catalog(Groq routes by deployment, Ollama by local pull). Two-argSetProvider('groq', k)leftTConfig.Create's seedclaude-opus-4-7asDefaultModel, silently sending the wrong model toapi.groq.com.Fixes:
FModel := Override.Modelfrom bothTPasClawAgent.SetProviderandTPasClawServer.SetProvider.FModelis reserved for the embedder's explicit choice (Create(model)orModel :=); SetProvider stays out.ChatHistory's fallback toFConfig.DefaultModel(whichApplyProviderOverridealways sets) handles the switch correctly.BuildProviderOverrideraisesEPasClawRunwith a clear pointer to the three-arg overload when neither caller nor catalog supplies a model. Two-argSetProviderforanthropic/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
make clean && make smoke11/11 green. Three sample binaries still build. dcc32 cmdline flow now reaches the sameDCC_UnitSearchPaththe.dprojfiles provide via MSBuild (full Delphi validation pending an actual dcc32 install).https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
Generated by Claude Code