Commit graph

6504 commits

Author SHA1 Message Date
claude[bot]
cbb75f2cba style: auto-fix linting issues 2026-04-28 12:54:06 +00:00
ali
ee71e34e51 Merge branch 'codeflash/optimize-pr2627-2026-04-28T12.46.41' of github.com:codeflash-ai/codeflash-internal into codeflash/optimize-pr2627-2026-04-28T12.46.41 2026-04-28 15:52:14 +03:00
ali
dd7cb28da9 cleaning up 2026-04-28 15:51:13 +03:00
claude[bot]
d8c659e95a fix: remove duplicate _extract_go_code_block definition
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 12:49:56 +00:00
codeflash-ai[bot]
e61ea39fdb
Optimize parse_and_validate_go_output
The optimization replaced the DOTALL regex `GO_CODE_PATTERN.search()` with a manual linear scan (`_extract_go_code_block`) that uses `str.find()` to locate fence delimiters and validate opening/closing structure. Profiler data shows this cut the pattern-matching cost from ~628 µs to ~367 µs (41% reduction), which is the critical path for inputs with large surrounding text or many fence candidates. The manual scanner avoids regex backtracking and match-object allocation overhead while preserving identical semantics (MULTILINE anchor, optional "go" token, mandatory surrounding newlines). Test cases confirm correctness across all edge cases, with large-input tests showing 175–1236% speedup where the old regex scanned kilobytes of text repeatedly.
2026-04-28 12:46:45 +00:00
mohammed ahmed
3d6488adda
Merge branch 'main' into cf-go-language-support 2026-04-28 15:02:31 +03:00
ali
e3178dd8bc revert logging back to debug 2026-04-28 15:00:58 +03:00
ali
a0546e22d2 feat: improve Go test generation prompts
Fix package declaration to match code under test (prevents build errors), warn
against string(int) Unicode trap, and pass package_name to system prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-28 12:45:15 +03:00
codeflash-ci-bot[bot]
d5180b643a
chore: update tessl tiles 2026-04-27 (#2626)
## Summary

Automated weekly tessl tile update:
- Updated existing tiles to latest versions
- Installed newly available tiles for project dependencies

Generated by the **tessl-update** workflow.

Co-authored-by: codeflash-ci-bot[bot] <codeflash-ci-bot[bot]@users.noreply.github.com>
2026-04-27 05:12:35 -05:00
ali
778b2af459
log features 2026-04-25 11:09:54 +03:00
ali
1d6d17462e
base go support 2026-04-23 18:01:12 +02:00
codeflash-ci-bot[bot]
829bb738c6
chore: update tessl tiles 2026-04-23 (#2624)
## Summary

Automated weekly tessl tile update:
- Updated existing tiles to latest versions
- Installed newly available tiles for project dependencies

Generated by the **tessl-update** workflow.

Co-authored-by: codeflash-ci-bot[bot] <codeflash-ci-bot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2026-04-23 08:15:41 -05:00
Kevin Turcios
a8d283736a chore: add ready-to-merge gate for branch freshness 2026-04-23 08:12:11 -05:00
Kevin Turcios
586ca2e8c1
Merge pull request #2625 from codeflash-ai/fix/missing-tiles-format
fix: use proper tile names in missing-tiles.txt
2026-04-23 08:07:16 -05:00
Kevin Turcios
430d429076 fix: use proper tile names in missing-tiles.txt 2026-04-23 08:06:55 -05:00
Kevin Turcios
1165c25602
Merge pull request #2623 from codeflash-ai/fix/tessl-app-token
fix: pass CI bot secrets to tessl update workflow
2026-04-23 08:04:55 -05:00
Kevin Turcios
65838dc916 fix: pass CI bot secrets to tessl update workflow 2026-04-23 08:04:02 -05:00
Kevin Turcios
07d2d97ba2
Merge pull request #2622 from codeflash-ai/fix/tessl-caller-permissions
fix: add permissions to tessl update caller workflow
2026-04-23 07:50:41 -05:00
Kevin Turcios
b0bf17b0ee fix: add permissions to tessl update caller workflow 2026-04-23 07:49:54 -05:00
Kevin Turcios
10ec11c25a
Merge pull request #2621 from codeflash-ai/chore/tessl-vendored-setup
chore: initialize tessl with vendored tiles
2026-04-23 07:44:55 -05:00
Kevin Turcios
235c08d342 chore: initialize tessl with vendored tiles
Switch from managed to vendored mode so tiles are committed to git.
Install 55 tiles (Python + JS/TS), add MCP configs, and set up
weekly tile update workflow via reusable github-workflows caller.
2026-04-23 07:42:51 -05:00
Kevin Turcios
235858d205
Migrate aiservice-test to shared workflow with dynamic secret env (#2620)
## Summary

- Replaces the inline `aiservice-test` job (30 lines of boilerplate)
with a 10-line shared workflow call
- Uses the new `test-secret-env` input on `ci-python-uv.yml` to
dynamically export 7 secrets as masked env vars
- Pattern: caller passes `secrets: inherit` + a JSON map of `{ENV_VAR:
SECRET_NAME}`, shared workflow uses `toJSON(secrets)` + jq to export
them with `::add-mask::`

### Before (inline)
```yaml
aiservice-test:
  runs-on: ubuntu-latest
  env:
    SECRET_KEY: ${{ secrets.SECRET_KEY }}
    DATABASE_URL: ${{ secrets.DATABASE_URL }}
    # ... 5 more hardcoded secret refs
  steps:
    - uses: actions/checkout@v6
    - uses: astral-sh/setup-uv@v8.1.0
    - run: uv sync
    - run: uv run pytest
```

### After (shared workflow)
```yaml
aiservice-test:
  uses: codeflash-ai/github-workflows/.github/workflows/ci-python-uv.yml@main
  secrets: inherit
  with:
    working-directory: "django/aiservice"
    sync-command: "uv sync"
    test-command: "uv run pytest"
    test-secret-env: '{"SECRET_KEY": "SECRET_KEY", "DATABASE_URL": "DATABASE_URL", ...}'
```

First consumer of the `test-secret-env` feature — validates the pattern
for future jobs.

## Test plan

- [ ] CI passes — aiservice-test job runs via shared workflow and
secrets are correctly exported
- [ ] Gate job (required-checks-passed) still works with the new job
structure
- [ ] No regression in other jobs (they're unchanged)
2026-04-23 06:00:11 -05:00
Kevin Turcios
eeecdc11d7
Bump stale GitHub Actions versions (#2618)
## Summary

Bumps all stale GitHub Actions to their latest stable versions across 7
workflow files.

### Changes

| Workflow | Action | Old | New |
|---|---|---|---|
| `ci.yaml` | `astral-sh/setup-uv` | `@v8.0.0` / `@v7` (inline jobs
only) | `@v8.1.0` |
| `claude.yml` | `astral-sh/setup-uv` | `@v6` | `@v8.1.0` |
| `codeflash-aiservice.yaml` | `astral-sh/setup-uv` | `@v7` | `@v8.1.0`
|
| `codeflash-js.yaml` | `astral-sh/setup-uv` | `@v7` | `@v8.1.0` |
| `deploy_aiservice_to_azure.yml` | `astral-sh/setup-uv` | `@v7` |
`@v8.1.0` |
| `fix-formatting.yml` | `astral-sh/setup-uv` | `@v5` | `@v8.1.0` |
| `fix-formatting.yml` | `j178/prek-action` | `@v1` | `@v2` |
| `publish-to-pypi.yml` | `pypa/gh-action-pypi-publish` | `@master` |
`@release/v1` |

### Notes

- Shared workflow refs (`codeflash-ai/github-workflows/...@main`) in
`ci.yaml` are **not** changed -- those follow `@main` and will pick up
updates from the shared workflows repo.
- `publish-to-pypi.yml` is currently disabled (`if: false`) but the ref
is fixed anyway to avoid issues when re-enabled.

## Test plan

- [ ] CI passes on this PR (the workflow files themselves are the
change, so CI validates they parse correctly)
- [ ] Verify `ci.yaml` shared workflow `uses:` lines still reference
`@main`
2026-04-23 05:49:17 -05:00
Kevin Turcios
0d968a0652
Fix VSCode extension build: regenerate package-lock.json (#2617)
## Summary

- Snyk PR #2305 bumped `diff` from 8.0.2 to 8.0.3 in
`js/VSC-Extension/package.json` without regenerating the lockfile
- This causes `npm ci` to fail with a "package.json and
package-lock.json are in sync" error
- Ran `npm install` to regenerate `package-lock.json` (resolves `diff`
to 8.0.4, the latest matching `^8.0.3`)

## Test plan

- [x] Verified `npm ci` succeeds with the updated lockfile
- [x] Diff is minimal: only the `diff` package version change (4
insertions, 4 deletions)
2026-04-23 05:44:18 -05:00
Kevin Turcios
72cb04ead1
Remove old CI workflow files (consolidated into ci.yaml) (#2616)
Delete 7 separate workflow files now replaced by the unified ci.yaml:
aiservice-ci.yml, cf-api-tests.yaml, cf-webapp-quality-gates.yml,
end-to-end-tests.yaml, nextjs-build.yaml, prek.yaml,
vscode-extension-build.yml
2026-04-23 05:32:30 -05:00
Kevin Turcios
cf28fa6299
Consolidate CI into single workflow with shared actions (#2614)
Replace 7 separate CI workflow files with a unified ci.yaml that uses
shared workflows from codeflash-ai/github-workflows:

- determine-changes: reusable workflow for path-based change detection
- prek-lint: reusable workflow for pre-commit checks
- ci-python-uv: reusable workflow for Python typecheck
- required-checks-gate: composite action for gate job

All downstream jobs use fromJSON(needs.determine-changes.outputs.flags)
for conditional execution. A single required-checks-passed gate job
replaces per-workflow required checks.

Private repos need explicit permissions on reusable workflow calls
(contents:write for prek) since they don't inherit permissive defaults.
2026-04-23 05:26:05 -05:00
Kevin Turcios
d4ad423273
Unpin claude-code-action from v1.0.89 to @v1
Bedrock SigV4 auth regression (anthropics/claude-code-action#1193) was fixed in Claude Code 2.1.97, shipped in v1.0.91. Latest is v1.0.104.
2026-04-23 04:10:10 -05:00
Kevin Turcios
3d1b843da4 Fix code repair for raw (non-markdown) source code input
The Python client sends raw source code, not markdown-wrapped blocks.
split_markdown_code() returned {} for raw input, making SearchAndReplaceDiff
have nothing to patch, so repairs always returned empty string.

Now falls back to {"file.py": raw_code} when markdown parsing yields nothing,
and is_valid() handles raw code blocks instead of only markdown-wrapped ones.
2026-04-21 20:42:01 -05:00
Kevin Turcios
34eb74342d Improve code repair prompts and test detail formatting
System prompt now focuses on repair strategy (identify pattern, compare
code, minimal fix) instead of spending most tokens on SEARCH/REPLACE
format spec. User prompt explicitly frames the task and asks for root
cause analysis. build_test_details() reformatted for clarity: grouped
by test source with clear Expected/Got lines separated by --- dividers.
2026-04-21 17:54:03 -05:00
Aseem Saxena
a3f0c07bb6
fix: allow Monaco editor CDN in CSP for trace page diffs (#2611)
## Summary
- The Monaco diff editor on `/trace/[id]` pages was not loading because
`@monaco-editor/react` fetches JS, CSS, and font assets from
`cdn.jsdelivr.net` by default
- The Content Security Policy in `next.config.mjs` blocked those
requests (missing from `script-src`, `style-src`, `font-src`)
- Added `https://cdn.jsdelivr.net` to the three relevant CSP directives

## Test plan
- [ ] Open a trace page (e.g.
`/trace/c0668bd3-9321-4082-9c43-3e41bdd9b1c5`) and verify the code diff
renders
- [ ] Check browser console for no remaining CSP violations
- [ ] Verify no regressions on other pages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
2026-04-22 04:07:40 +05:30
Kevin Turcios
f9c6376f14 Strengthen test examples prompt to emphasize behavioral correctness
Reworded to highlight that hand-written unit tests encode the developer's
explicit behavioral expectations and that optimizations must produce
identical results for all test cases.
2026-04-21 17:06:40 -05:00
Kevin Turcios
ccfe0998e7 Wire baseline runtime, test examples, and LP diversity into optimizer
Accept baseline_runtime_ns, loop_count, line_profiler_results, and
test_input_examples on the optimize endpoint. Pass runtime context
and test examples to the user prompt so the LLM can generate
better-informed candidates. Alternate line profiler data across
parallel calls for diversity (odd calls get LP, even calls don't).
2026-04-21 15:48:47 -05:00
Kevin Turcios
9b3cd48048 Raise LLMOutputUnparseable on empty LLM responses instead of silently returning ""
When Azure OpenAI or Anthropic returns null/empty content (content
filter, truncation, transient failure), call_openai/call_anthropic now
raise LLMOutputUnparseable instead of returning an empty string that
silently flows through the pipeline and produces 422 "Could not
generate any optimizations." All optimizer callers catch
LLMOutputUnparseable to preserve cost tracking while returning None.
2026-04-21 05:59:07 -05:00
Saurabh Misra
7355b05663
Merge pull request #2610 from codeflash-ai/cf-rl-env-catalog
Codeflash RL Environment for Roboflow Inference to train AI Agents for optimization
2026-04-16 16:35:50 -07:00
Saurabh Misra
9d4ecd07e8
Merge branch 'main' into cf-rl-env-catalog 2026-04-16 16:35:27 -07:00
misrasaurabh1
2a101a11f2 add universe optimize orchestrator with project management, 2026-04-16 16:34:36 -07:00
misrasaurabh1
a52d80b0aa add missing_commits_bundle_note.txt to base-image 2026-04-16 16:34:05 -07:00
misrasaurabh1
b3f164dcda rl env files 2026-04-16 16:31:25 -07:00
Kevin Turcios
791ee34f0d fix: target codeflash-webapp-2 staging with standalone deploy 2026-04-15 07:55:42 -05:00
Kevin Turcios
e1c1f13701 revert: drop node-linker=hoisted from .npmrc
node-linker=hoisted triggers an Invalid Version bug in pnpm 10 bin
linking. The standalone output with zip -y (symlink preservation) is
sufficient — Azure SquashFS supports symlinks natively.
2026-04-15 07:47:35 -05:00
Kevin Turcios
3f7baf9ab3 fix: preserve pnpm symlinks in standalone zip for Azure deployment
Use zip -y to preserve symlinks in the standalone output. Azure Linux
App Service mounts the zip via SquashFS which supports symlinks. This
keeps the pnpm .pnpm/ structure intact so next can resolve peer deps
like @swc/helpers and @next/env from their co-located positions.

Also re-add node-linker=hoisted to .npmrc per pnpm docs recommendation
for environments that need standard node_modules resolution.
2026-04-15 07:41:19 -05:00
Kevin Turcios
ae9e3011e7 fix: use Next.js standalone output for Azure deployment
Switch from zipping cf-webapp/node_modules to Next.js standalone output
mode. This traces only required runtime deps into .next/standalone/ and
resolves the pnpm symlink issues that caused MODULE_NOT_FOUND crashes on
Azure (missing @next/env, @swc/helpers).

- Add output: "standalone" and outputFileTracingRoot to next.config.mjs
- Update CI to cp -rL (dereference symlinks) the standalone output
- Revert node-linker=hoisted from .npmrc (no longer needed)
- Deploy to codeflash-webapp-main (set in previous commit)
2026-04-15 07:29:16 -05:00
Kevin Turcios
ea60289699 fix: hoist pnpm deps and deploy to codeflash-webapp-main
Add node-linker=hoisted to .npmrc so pnpm hoists all dependencies like
npm. Update CI to rsync workspace-root node_modules into cf-webapp
before zipping, ensuring @next/env, @swc/helpers, and other peer deps
are included. Retarget deployment to the new codeflash-webapp-main app.
2026-04-15 07:04:41 -05:00
Kevin Turcios
e2940da25f fix: add @swc/helpers as direct dependency for Azure deployment
pnpm doesn't hoist @swc/helpers to cf-webapp/node_modules/ by default,
so it's missing from the deploy zip. Azure runs npm start which can't
resolve it through pnpm's virtual store. Adding it as a direct dep
ensures it's included in the zip.
2026-04-15 06:47:06 -05:00
Kevin Turcios
459f07dde2 fix: remove redundant auth check from roadmap page
The page-level isTeamMember() check breaks PPR (Partial Prerendering):
at build time there's no session, so the prerender resolves as a
redirect/404 and the static shell poisons all runtime responses with 404.

Team member gating is already handled by proxy.ts middleware (lines 50-58),
matching how /observability and other team-gated routes work.
2026-04-15 05:23:46 -05:00
Kevin Turcios
0cbd8e0b6c
Adopt shared CI workflow for aiservice (#2609)
## Summary

- Add `aiservice-ci.yml` using the shared reusable workflow from
`codeflash-ai/github-workflows`
- Remove old `django-unit-tests.yaml` and `mypy_aiservice.yml` (both
replaced by the new unified workflow)
- **Typecheck job**: uses the shared workflow
(`codeflash-ai/github-workflows/.github/workflows/uv-mypy.yml`)
- **Test job**: defined locally in `aiservice-ci.yml` (needs repository
secrets that can't be passed to reusable workflows in other repos)

## What changed

| Before | After |
|---|---|
| `django-unit-tests.yaml` (standalone) | `aiservice-ci.yml` — test job
|
| `mypy_aiservice.yml` (standalone) | `aiservice-ci.yml` — typecheck job
(shared workflow) |
2026-04-15 02:32:22 -05:00
Kevin Turcios
4c9cdff1b0
fix: replace hardcoded edit secret with session auth (#2608)
## Summary
- Replace hardcoded `"codeflash-edit-2025"` string authentication in the
`save-modified-code` API route with Auth0 session check
- Remove the secret prompt modal from the Monaco diff viewer — editing
is now gated by the user's existing login session
- Remove unused `Lock` import, dead `console.log`, and unused `result`
variable

## Test plan
- [ ] Verify the edit code button works without prompting for a secret
- [ ] Verify saving modified code succeeds for logged-in users
- [ ] Verify unauthenticated requests to
`/api/traces/:id/save-modified-code` return 401
2026-04-14 21:59:58 -05:00
Kevin Turcios
e5374c3f50
fix: provide JWT_SECRET to CI build workflows (#2607)
## Summary
- Reverts lazy JWT_SECRET initialization — keeps eager fail-fast at
module load
- Adds `JWT_SECRET` secret to both `deploy_cfwebapp_to_azure.yml` and
`nextjs-build.yaml` CI workflows so `next build` page data collection
succeeds for the `/codeflash/auth/oauth/token` route

## Context
The deploy workflow ([run
#24425211765](https://github.com/codeflash-ai/codeflash-internal/actions/runs/24425211765/job/71357530269))
was failing because `JWT_SECRET` isn't available during CI build,
causing an eager throw at module load time. The secret already exists as
a GitHub repo secret.
2026-04-14 19:25:41 -05:00
Kevin Turcios
e6cec80c9d
Merge pull request #2606 from codeflash-ai/fix/cf-webapp-security-hardening
fix: harden cf-webapp security across auth, XSS, and headers
2026-04-14 17:04:44 -05:00
Kevin Turcios
1fada04c22 fix: repair bad merge in review-optimizations authorization checks
Duplicate and mangled if-blocks from the merge of #2605 caused a syntax
error that broke type-checking.
2026-04-13 19:38:24 -05:00