Fix QA findings: session model persistence, pre-provision native-tool validation, url output, native-tool error message#52
Merged
Conversation
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.
Four fixes on top of #51 (
--mode/--native-toolaction planes).Named sessions forget model/mode/native-tool
Problem: a named session (
-s foo) didn't remember which model it was driven with —cua -s foo do ...with an anthropic model followed bycua -s foo urlsilently fell back to the default openai model. Worse, an explicit mid-session provider switch could send a foreignprevious_response_id(e.g. an Anthropicmsg_id) to the OpenAI Responses API.Fix: named-session metadata now persists
model,mode, andnative_tool.setupHarnessRuntimedefaults-m/--mode/--native-toolfrom the stored values when not passed explicitly, and after each run the effective values are recorded back.cua session startaccepts-mto seed the session's model. Separately,responseThreadingDeltanow takes the provider api and refuses to anchorprevious_response_idon an assistant turn produced by a different api — an explicit provider switch replays full converted history instead (anthropic/google paths were already full-replay).Tests: new
harness-named-sessions.test.ts(persistence + default application) and cross-api anchor rejection tests in both the openai and tzafon threading suites.Invalid mode/native-tool combos validated only after provisioning
Problem: an invalid combination (e.g.
--native-tool computer_20260701with an openai model, or--mode browserwith a computer native tool) was rejected only after a Kernel browser had already been provisioned — wasting a browser and delaying the error.Fix:
setupHarnessRuntimecallsresolveCuaRuntimeSpec(modelRef, { mode, nativeTool })right after flag parsing and beforeprovisionForFlags, so all three entry paths (print, interactive, one-shot actions) fail fast. Error wording unchanged — the same errors just fire earlier.Tests: new
cli-harness-validation.test.tsmocksprovisionBrowserand asserts each rejection fires with the browser never provisioned.cua urloutput wrapped in markdownProblem: the
urlaction could emit the URL wrapped in markdown (**https://…**, backticks), breaking consumers that expect a bare URL.Fix:
extractFirstUrlnow also strips trailing*,_, and backticks (leading chars were never included since the match starts at the scheme), and the url prompt asks for a bare URL with no markdown.Tests: new
action-result.test.tscovering bold-wrapped, backtick-wrapped, trailing-punctuation, and plain cases.Native-tool provider mismatch error omits the mode requirement
Problem: using an Anthropic native tool with a non-anthropic model produced an error that only mentioned the provider requirement, leaving the user to hit a second error about the mode pairing.
Fix: the provider-mismatch error in
resolveNativeToolnow states the full requirement:native tool "computer_20260701" requires an anthropic model paired with mode "computer"; got provider "openai". Ordering unchanged.Tests: updated
native-tools.test.tsassertions (and the new validation test above).Validation
npm run typecheckandnpm run build:clipass.@onkernel/cua-cli: 49 passed, 5 skipped (API-key-gated).@onkernel/cua-agent: 72 passed, 12 skipped.@onkernel/cua-ai: 142 passed, 1 failure inapi-keys.test.ts— pre-existing and environment-caused (a realGOOGLE_API_KEYin the test environment overrides the fixture; the test passes with the env var unset). Not touched here.Nothing was left unfixed — all four issues are addressed in this PR.