Skip to content

Fix Codewith auth profile preflight for API key profiles#47

Open
andrei-hasna wants to merge 1 commit into
mainfrom
openloops/open-loops/1d5fb071-a24f-4a66-9e72-ae42035a7ed8-14bd9d4c
Open

Fix Codewith auth profile preflight for API key profiles#47
andrei-hasna wants to merge 1 commit into
mainfrom
openloops/open-loops/1d5fb071-a24f-4a66-9e72-ae42035a7ed8-14bd9d4c

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Teach Codewith auth-profile preflight to prefer codewith profile list --json and accept usable named profiles such as openai-api-default.
  • Preserve legacy text-table fallback for older Codewith CLIs and remote preflight scripts.
  • Add local and remote regression coverage where openai-api-default exists only in JSON inventory and missing profiles still fail.

Validation

  • bun test src/lib/executor.test.ts
  • bun run typecheck
  • bun run build
  • bun test --timeout 15000
  • staged credential-pattern scan: clean

Notes

The default bun test timeout is 5s; src/lib/route/drain.test.ts takes about 5.8s on this worker, so the full-suite pass used --timeout 15000.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Merge blocked after worker review.

Evidence:

  • PR Fix Codewith auth profile preflight for API key profiles #47 is open, clean/mergeable, non-draft, and GitHub CI is green for bun on Ubuntu and macOS.
  • Focused local validation on PR head 406323d passed: bun test src/lib/executor.test.ts (38 pass) and git diff --check clean.
  • Wider local validation was inconclusive because this isolated worktree is missing dependencies (tsc, MCP SDK, ai, commander, optional @hasna/machines), while GitHub CI is green.

Blocker:
The remote bootstrap parses codewith profile list --json with line-oriented awk in src/lib/executor.ts. That parser depends on pretty-printed one-object-per-block formatting. Compact JSON with multiple usable profiles is treated as one object and the greedy name extraction only matches the last profile, so a valid earlier API-key profile can still be reported missing. Repro against the exact awk logic: compact JSON with profiles first and second returns first compact_status=1, second compact_status=0.

Codewith currently emits pretty JSON via serde_json::to_string_pretty, but a --json consumer should not depend on line layout. Please replace the ad hoc remote JSON parsing or define/enforce a safe remote parsing contract, and add a regression test with compact JSON containing at least two usable profiles.

I could not submit a formal request-changes review because GitHub rejects review requests from the PR owner account, so this is recorded as a PR comment instead.

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.

1 participant