Skip to content

Commit 04785c8

Browse files
kapaleshreyasclaude
andcommitted
fix(gitagent-adapter): normalize the MERGED model in harden() too
The earlier normalizer (commit 9d9b249) only ran on the loader-side model preference from agent.yaml. When a caller passes options.model="claude-haiku-4-5-20251001" (bare) on the request body, mergeEngineOptions overrides the prefixed value, and gitclaw's parseModelString throws "Invalid model format". The throw is swallowed inside gitclaw's query() setup — the iterator returns zero messages, engine.turn.end fires in ~20ms with no yields, and the harness has nothing to forward, so the client sees session_started → silence. Surfaced on the live test page: posting a PDF to api.clawagent.sh with runtime=bwrap + harness=gitagent + a bare model name hung for >1 min with no error. EC2 journalctl showed engine.turn.end durationMs=18 and no LLM call ever happened. Same failure mode as issue #6 (silent hang), this time at the model-normalization layer. Fix: harden() now re-normalizes merged.model after merge, so bare names get the "provider:" prefix regardless of where they came from. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent aa98c91 commit 04785c8

4 files changed

Lines changed: 29 additions & 12 deletions

File tree

packages/identity-gitagentprotocol/src/adapters/gitagent.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ export async function gapToGitagentOptions(
7373
return {
7474
options: opts,
7575
harden: (merged) => {
76-
if (requireHumanReview) {
77-
return { ...merged, requireHumanReview: true };
76+
// Re-normalize the model AFTER merge so caller-supplied bare names
77+
// (e.g. options.model="claude-haiku-4-5-20251001") get the gitclaw
78+
// "provider:modelId" prefix. Without this, gitclaw's parseModelString
79+
// throws "Invalid model format" inside query() and the error is
80+
// swallowed — query() returns 0 messages, the engine looks healthy
81+
// but actually died at init. See issue #6.
82+
const out: GitagentOptions = { ...merged };
83+
if (typeof out.model === "string") {
84+
out.model = normalizeGitclawModel(out.model);
7885
}
79-
return merged;
86+
if (requireHumanReview) out.requireHumanReview = true;
87+
return out;
8088
},
8189
};
8290
}

packages/runtime-e2b/assets/harness-bundle.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139594,10 +139594,13 @@ async function gapToGitagentOptions(manifest, workdir) {
139594139594
return {
139595139595
options: opts,
139596139596
harden: (merged) => {
139597-
if (requireHumanReview) {
139598-
return { ...merged, requireHumanReview: true };
139597+
const out = { ...merged };
139598+
if (typeof out.model === "string") {
139599+
out.model = normalizeGitclawModel(out.model);
139599139600
}
139600-
return merged;
139601+
if (requireHumanReview)
139602+
out.requireHumanReview = true;
139603+
return out;
139601139604
}
139602139605
};
139603139606
}

packages/runtime-local/assets/harness-bundle.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180713,10 +180713,13 @@ async function gapToGitagentOptions(manifest, workdir) {
180713180713
return {
180714180714
options: opts,
180715180715
harden: (merged) => {
180716-
if (requireHumanReview) {
180717-
return { ...merged, requireHumanReview: true };
180716+
const out = { ...merged };
180717+
if (typeof out.model === "string") {
180718+
out.model = normalizeGitclawModel(out.model);
180718180719
}
180719-
return merged;
180720+
if (requireHumanReview)
180721+
out.requireHumanReview = true;
180722+
return out;
180720180723
}
180721180724
};
180722180725
}

packages/runtime-vzvm/assets/harness-bundle.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139594,10 +139594,13 @@ async function gapToGitagentOptions(manifest, workdir) {
139594139594
return {
139595139595
options: opts,
139596139596
harden: (merged) => {
139597-
if (requireHumanReview) {
139598-
return { ...merged, requireHumanReview: true };
139597+
const out = { ...merged };
139598+
if (typeof out.model === "string") {
139599+
out.model = normalizeGitclawModel(out.model);
139599139600
}
139600-
return merged;
139601+
if (requireHumanReview)
139602+
out.requireHumanReview = true;
139603+
return out;
139601139604
}
139602139605
};
139603139606
}

0 commit comments

Comments
 (0)