Repository navigation
Conversation
Two blockers found on a clean first run of `copperhead create` with an
openai-compat provider:
1. propose_change rejected array args. The model sent what_changes/tasks as
JSON arrays (the natural shape for a bullet list and a checklist); str()
threw 'missing required string arg "what_changes"' on every call, so the
stage re-sent the same array 23 times and burned its turn budget without
writing anything. Accept string | string[] and join with newlines, and say
what was received when neither is given.
2. git identity. gitPreflight checked repo/commits/dirty but not an author
identity, so a stage that passed all gates died at its commit with exit
128 ('Please tell me who you are') after spending its budget. Gate it up
front with the same why/how-to-fix shape as the other preflight refusals.
Confidence Score: 3/5
[Medium impact] The changes affect proposal creation and Git preflight in `copperhead create`. Fix the Codex proposal failure and the rejection of valid Git identities before merging. FindingsFix with agent prompt### Issue 1
src/capabilities/handlers.ts:245-250
The new `anyOf` fields break `propose_change` for Codex, even with previously valid string arguments. Codex's `validateJsonSchema` rejects `anyOf` as an unsupported keyword before the handler runs. Every proposal call therefore fails, leaving edit tools locked. Add union support to the Codex validator and test both argument forms through the provider.
### Issue 2
src/util/git.ts:192-197
If a wrapper or CI job supplies identity through `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, and `GIT_COMMITTER_EMAIL`, Git can commit without `user.name` or `user.email` in config. `gitIdentity` reads only those config keys, so the new preflight refuses these working setups before any agent work starts. Check Git's effective author and committer identities, for example with `git var GIT_AUTHOR_IDENT` and `git var GIT_COMMITTER_IDENT`, instead.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThis PR accepts string arrays in proposal fields and adds a Git identity check before agent work.
|
| what_changes: { | ||
| anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], | ||
| description: 'markdown bullet list of changes (a string, or an array of bullet strings)', | ||
| }, | ||
| tasks: { | ||
| anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], |
There was a problem hiding this comment.
The new anyOf fields break propose_change for Codex, even with previously valid string arguments. Codex's validateJsonSchema rejects anyOf as an unsupported keyword before the handler runs. Every proposal call therefore fails, leaving edit tools locked. Add union support to the Codex validator and test both argument forms through the provider.
Knowledge Base Used: Model provider integration
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/capabilities/handlers.ts
Line: 245-250
Comment:
**Codex cannot submit proposals**
The new `anyOf` fields break `propose_change` for Codex, even with previously valid string arguments. Codex's `validateJsonSchema` rejects `anyOf` as an unsupported keyword before the handler runs. Every proposal call therefore fails, leaving edit tools locked. Add union support to the Codex validator and test both argument forms through the provider.
**Knowledge Base Used:** [Model provider integration](https://app.greptile.com/-/switch-tenant?tenant=copperhead&next=%2Fcustom-context%2Fknowledge-base%2Fcopperheadhq%2Fcopperhead%2F-%2Fdocs%2Fmodel-provider-integration.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| export async function gitIdentity(repo: string): Promise<{ name: string; email: string }> { | ||
| const read = async (key: string): Promise<string> => { | ||
| const res = await execa('git', ['config', '--get', key], { cwd: repo, reject: false }); | ||
| return res.exitCode === 0 ? String(res.stdout).trim() : ''; | ||
| }; | ||
| return { name: await read('user.name'), email: await read('user.email') }; |
There was a problem hiding this comment.
Valid Git identities are refused
If a wrapper or CI job supplies identity through GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL, Git can commit without user.name or user.email in config. gitIdentity reads only those config keys, so the new preflight refuses these working setups before any agent work starts. Check Git's effective author and committer identities, for example with git var GIT_AUTHOR_IDENT and git var GIT_COMMITTER_IDENT, instead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/util/git.ts
Line: 192-197
Comment:
**Valid Git identities are refused**
If a wrapper or CI job supplies identity through `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, and `GIT_COMMITTER_EMAIL`, Git can commit without `user.name` or `user.email` in config. `gitIdentity` reads only those config keys, so the new preflight refuses these working setups before any agent work starts. Check Git's effective author and committer identities, for example with `git var GIT_AUTHOR_IDENT` and `git var GIT_COMMITTER_IDENT`, instead.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
baseline check so the failing files are not blamed on this pr. full suite on this branch: 6 failed files, 27 failed tests, 1439 passed. the same files fail identically on plain main (9b34ced, none of my changes): the rest sit in the same kicad-cli / zone / reference-board group (board-populate, create-layout-draft, draft-reference-boards), so they read as an environment gap on this box rather than a regression. the two files this pr touches are green: test/propose-change-args.test.ts 3 passed, test/preflight.test.ts 19 passed, tsc --noEmit clean. |
|
run update after the comment above: 4 of 8 stages commit clean now. commits in the target repo: 3b54401 spec-seed, f20641c architecture, b653fa8 part-selection, 5ad61e5 schematic. so the two fixes here carry a run from stage 1 (never wrote a file) to stage 5 (a placed board that fails DRC), which is further than the manual runs described in the issue. layout-draft is where it stops for me: 20 unrouted connections on a free flash-lite model, no repair cycles left. that reads as routing difficulty rather than a tool bug, so i am not filing it as a blocker, just as the current ceiling of this setup. |
…identity via git var
|
both were right, fixed in 0b41332. codex: git identity:
|
Partial contribution to #66, not the full bounty deliverable. It fixes two blockers that wedged
createon my first clean runs and adds a findings report with evidence from five real runs.Scope, honestly:
createnow gets from wedged at stage 1 to stages 1 and 2 committed with stage 3 running clean. I did not drive all 8 stages to a finish, and this PR does not include the repo-backed e2e harness the issue asks for. PRs #517, #454 and #441 are further along on that. Judge this one as two small isolated fixes.changes
1.
propose_changeaccepts markdown-list args (src/capabilities/helpers.ts,handlers.ts)The schema says
what_changesandtasksare strings, but a model writing a bullet list emits a JSON array.str()rejected that, so the run resent the same array every turn and spent the stage budget writing nothing:The arg means a list of lines either way.
markdown()joinsstring | string[]with newlines, the schema advertises both shapes viaanyOf, and the error names what arrived (empty array,got number) instead of only that the string is missing. After the fix the same brief on the same model validated on turn 2 and unlocked the edit tools.2.
gitPreflightgates on a git author identity (src/util/git.ts)Preflight checked repo, commits and dirty tree but not identity, so a stage that passed every gate died at its own commit:
Six turns and 61.8k input tokens went into verified work that was then stashed. The message carries git's exit code but not git's reason (
*** Please tell me who you are). Now it refuses up front with the same reason / why it failed / to fix shape as the other preflight refusals, names the unset key, and gives thegit config user.emailremedy.findings
Format is Where / Symptom / Suggested / Status, with P0-P3 for recommendations. Environment for every run:
examples/simple/usb-c-breakout.mdbrief,compat:<model>against an OpenAI-compatible endpoint, kicad-cli 9.0.8, node 26.12.1, linux-arm64.BLOCKER: propose_change rejects an array, no recovery (fixed here)
src/capabilities/handlers.ts:242-245,src/capabilities/helpers.ts:6-10missing required string arg "what_changes"errors over turns 1 to 23. No file written, run endedstage-turn-budgetat 186.9k input tokens.string | string[], name the received type in the error.test/propose-change-args.test.tscovers array args, string args and an empty array.BLOCKER: no author-identity preflight, a finished stage fails at commit (fixed here)
src/util/git.ts:196-232(gitPreflight),src/util/git.ts:451(commitAll)all gates satisfied; run will committhencommit failed: Command failed with exit code 128. Whole stage rolled back to a stash.gitPreflight(done). Separately, show git's stderr oncommit-failed: execa attaches stderr, but(err as Error).messagekeeps only the exit code line, which sends the operator looking in the wrong place.test/preflight.test.tshides global and system config in the new case so it tests the gate and not the machine. stderr suggestion open.INEFFICIENCY: no repeat guard, one stuck call can drain the budget (P1, open)
src/agent/loop.ts(turn loop, thenudgescounter only covers tool-less turns)propose_change23 times in stage 1.search_symbols8 times across 4 queries in stage 3, every one answeringno installed KiCad symbol library directories found on this machine.(name, canonical args, error message)triples and end the stage at about 5 with a diagnostic naming the tool, the args and the error. A model that cannot change a call's outcome should not repeat it 20 times. Thenudgescounter is the existing precedent for a stop-this-is-stuck path.DEFECT: doctor prints bare EACCES when an
openspecdirectory is on PATH (P2, open)src/commands/doctor.ts:62-69,src/util/preflight.ts:26-36(isNotFoundError)copperhead/distonPATH(reasonable, it holdscli.js) doctor prints[FAIL] openspec Command failed with EACCES: openspec --version spawn openspecwith no hint. Spawning a directory is EACCES rather than ENOENT, soisNotFoundErrormisses it and the install hint is skipped.@fission-ai/openspecoff the registry. One line in the install docs covers it.@fission-ai/openspec2.3.0 and dist kept off PATH.NOTE: kicad without recommends gives a green doctor and an empty symbol search (P1, open)
src/commands/doctor.ts:89-111,src/kicad/symlib.ts(symbolSearchDirs)apt-get install --no-install-recommends kicadgiveskicad-cli9.0.8 and doctor reports[ok] kicad-cli 9.0.8, butkicad-symbolsandkicad-footprintsare separate packages on Debian and Ubuntu. Everysearch_symbolsanswersno installed KiCad symbol library directories found on this machineand part selection has nothing to resolve. The environment looks ready and is not.search_symbolscould also name the paths it looked in.kicad-symbolsandkicad-footprints.NOTE: first turn of a stage dumps the repo (P3, open)
src/capabilities/handlers.ts(search)search {pattern: ".*"}, roughly 5k tokens of every file in the target repo, before the brief is read. On a repo holding a brief and a.gitignorethat is only noise..*result.verification
Real run after both fixes, same brief and model, clean repo with an identity configured,
kicad-symbolsandkicad-footprintsinstalled:Logs, transcripts and run summaries for all five runs go in the comments, since they are the evidence for the three items I left open.