Commit graph

6260 commits

Author SHA1 Message Date
Kevin Turcios
ded2240818
Merge branch 'main' into allocs 2026-02-27 20:06:57 +00:00
Kevin Turcios
779fda2b36 slight changes 2026-02-27 15:02:08 -05:00
Kevin Turcios
1fedb8c443 refactor: rewrite explanation prompts with Jinja2 macros and tighter brevity constraints
- Extract shared content into Jinja2 macros (`section`, `field`,
  `code_field`) that handle Anthropic XML vs OpenAI markdown wrapping,
  eliminating full duplication of every section across both branches
- Tighten system prompt to enforce concise 3-6 sentence output: trim
  bloated per-field context descriptions, add concrete positive example,
  explicitly forbid section headers and bullet groups, move output_format
  to be the last section so constraints are closest to generation
- Add caveat that original_explanation is for factual reference only (in
  both system and user prompts) to prevent the model from mimicking its
  verbose multi-section format
- Condense throughput/concurrency/acceptance sections to essentials
- Rename misleading `## CRITICAL` heading to `## Acceptance Criteria`
2026-02-27 14:38:24 -05:00
Kevin Turcios
396d7cc7e8 refactor: modernize explanation prompts with Jinja2 templates
Extract inline prompts into .md.j2 templates, move schemas to
models.py, and add model_type branching (XML for Anthropic, markdown
for OpenAI) following the testgen pattern. Uses StrictUndefined,
trim_blocks, and lstrip_blocks.
2026-02-27 13:45:21 -05:00
Kevin Turcios
09fafeb914 fix: remove scroll-triggered CSS transitions causing jank in observability timeline
Reduce IntersectionObserver thresholds from 6 to 1, remove backdrop-blur
from sticky header, drop opacity/color/maxHeight transitions that fired
on every activeIndex change, and narrow progress bar to transition-[width].
2026-02-27 13:16:22 -05:00
Aseem Saxena
1a30f3eccb
Merge pull request #2440 from codeflash-ai/fix-middleware-llm-perf
fix: eliminate redundant DB queries in middleware and unblock LLM responses
2026-02-27 23:15:14 +05:30
Kevin Turcios
879a22454f
Merge branch 'main' into fix-middleware-llm-perf 2026-02-27 15:08:05 +00:00
Kevin Turcios
986688ceca feat: show recent traces on observability V2 landing page
Display the 10 most recent trace IDs on the empty state so users can
quickly jump to recent optimizations without searching.
2026-02-27 06:32:28 -05:00
Kevin Turcios
18ed70e031 feat: add adaptive optimization support to observability V2
Display ADAPTIVE source candidates in the timeline with Sparkles icon,
parent candidate linking, and ranking labels. Also fix the backend to
pass call_type, trace_id, and user_id to call_llm for proper
observability logging.
2026-02-27 06:32:28 -05:00
Aseem Saxena
c3a572b816
Merge pull request #2433 from codeflash-ai/testgen-jit-iter
extend tensor limit to `rand, randn, ones, zeros, empty, full, randint`
2026-02-26 04:12:48 +05:30
Aseem Saxena
be1480b937
Merge branch 'main' into testgen-jit-iter 2026-02-26 03:54:55 +05:30
claude[bot]
3f11204164 fix: add type parameter to asyncio.Task for mypy 2026-02-25 22:22:26 +00:00
Aseem Saxena
e97ca0d37f
Merge branch 'main' into fix-middleware-llm-perf 2026-02-26 03:49:53 +05:30
Aseem Saxena
924808e909
Merge pull request #2435 from codeflash-ai/reduce-recompilations
reduce rcompilations in the tests for jit function to test
2026-02-26 03:49:18 +05:30
HeshamHM28
29011d5cc3
Merge branch 'main' into fix-middleware-llm-perf 2026-02-25 12:32:52 -08:00
mashraf-222
879658cedb
Merge branch 'main' into testgen-jit-iter 2026-02-25 21:51:18 +02:00
mashraf-222
db871c321a
Merge branch 'main' into reduce-recompilations 2026-02-25 21:50:48 +02:00
Aseem Saxena
ef072a9b36
Merge pull request #2439 from codeflash-ai/cf-jit-output-format-prompt
fix: enforce direct JIT decorator in optimizer prompt for numerical code
2026-02-25 23:26:26 +05:30
Aseem Saxena
df6b4ba341
Merge branch 'main' into cf-jit-output-format-prompt 2026-02-25 23:12:54 +05:30
Aseem Saxena
0380f9ad0d
Merge branch 'main' into reduce-recompilations 2026-02-25 02:27:47 +05:30
Aseem Saxena
14feee119f
Merge branch 'main' into testgen-jit-iter 2026-02-25 02:27:41 +05:30
mohammed ahmed
3ae091bc5b
Merge pull request #2441 from codeflash-ai/improve-js-ts-validator-errors
feat: improve JS/TS validator with markdown support and error locations
2026-02-24 16:32:56 +02:00
claude[bot]
c6e9fc4530 fix: remove duplicate return statement in _find_error_location
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-24 12:57:02 +00:00
mohammed ahmed
f301be093c
Update django/aiservice/aiservice/validators/javascript_validator.py
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-02-24 14:54:56 +02:00
ali
c2eb63eb2e
feat: improve JS/TS validator with markdown support and error locations
Add markdown code block parsing, detailed syntax error locations with
line/col info, and structured logging to the JavaScript/TypeScript
validators.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 14:50:50 +02:00
claude[bot]
ae7110491c fix: add type ignore for Django ORM field type mismatch
Update type hints for `add_months_safe` and `get_next_subscription_period`
to accept both datetime.datetime and datetime.date, and add ty:ignore
comment for Django ORM field type that ty cannot infer correctly.

Co-authored-by: Aseem Saxena <aseembits93@users.noreply.github.com>
2026-02-24 10:37:33 +00:00
aseembits93
7f824ce101 fix: eliminate redundant DB queries in middleware and unblock LLM responses
Auth now attaches fetched organization/subscription to the request so
TrackUsageMiddleware reuses them instead of re-querying. RateLimitMiddleware
caches restricted_paths at init and uses async cache methods. LLM call
recording is fire-and-forget via asyncio.create_task to avoid blocking
responses on DB writes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 20:43:18 +05:30
aseembits93
d4867ef18e refactor: make line profiler JIT handling consistent with regular optimizer
Move JIT instructions appending from the per-call level
(optimize_python_code_line_profiler_single) to the endpoint level
(optimize endpoint), matching the regular optimizer's pattern.
This removes the is_numerical_code parameter threading through
the call chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 19:54:03 +05:30
aseembits93
0b523fc367 fix: enforce direct JIT decorator in optimizer prompt for numerical code
When is_numerical_code is true, the LLM sometimes outputs conditional
fallback paths (try/except, if/else) instead of applying the JIT
decorator directly. Add explicit output format instructions to prevent
this behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 19:49:24 +05:30
Kevin Turcios
033d14ea87
Merge branch 'main' into testgen-jit-iter 2026-02-23 08:56:11 +00:00
Kevin Turcios
f14ff077a6
Merge branch 'main' into reduce-recompilations 2026-02-23 08:55:29 +00:00
Kevin Turcios
05aecd6fbd
Merge pull request #2437 from codeflash-ai/misc-changes
fix: improve ranker scoring consistency and local-caching bias
2026-02-23 08:55:18 +00:00
Kevin Turcios
40ff909b03 fix: add DATABASE_URL and DJANGO_SETTINGS_MODULE to pr-review workflow
Coverage analysis in the Claude pr-review job needs these env vars
to run pytest, matching how django-unit-tests and codeflash-aiservice
workflows configure them.
2026-02-23 03:43:33 -05:00
claude[bot]
bf4e38c301 fix: add cast to satisfy ty type checker for list covariance
The ty type checker correctly flags that list[str] is not a subtype of list[str | None] due to list invariance. Added explicit cast.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-23 08:42:24 +00:00
Kevin Turcios
16e043883a style: auto-format ranker and test_markdown_utils 2026-02-23 03:39:38 -05:00
Kevin Turcios
85a1c8b183 fix: derive ranker ranking from structured scores instead of LLM array
The JSON parsing path returned the LLM's explicit ranking array,
which sometimes contradicted its own per-dimension scores. Use
_scores_to_ranking() to compute the ranking from weighted scores
when available, falling back to the LLM ranking only when scores
are absent.
2026-02-23 03:37:42 -05:00
Kevin Turcios
20ee6d5b62 fix: penalize local variable caching of globals in ranker prompt
The ranker LLM was rewarding candidates that cache global variables
into locals as a performance win. Add an explicit rule: this is only
relevant on Python ≤3.10; on 3.11+ LOAD_GLOBAL uses adaptive
specialization and is nearly as fast as LOAD_FAST.
2026-02-23 03:37:21 -05:00
Kevin Turcios
c95a36cf38 fix: handle nested code fences in extract_code_block
The non-greedy regex in FIRST_CODE_BLOCK_PATTERN stopped at the first
``` occurrence, even inside triple-quoted strings or nested code fence
blocks. This truncated the extracted code and lost test functions when
LLMs embedded function definitions using ```python:filepath syntax.

Switch to greedy matching and require the closing ``` to be alone on
its line so intermediate backticks are skipped.
2026-02-23 03:36:50 -05:00
Kevin Turcios
ca71d0c8a0 refactor: remove constructor notes preprocessing from testgen pipeline
Full class source is now included in the client-side testgen context,
making the server-side constructor signature extraction redundant.
2026-02-23 03:36:50 -05:00
Kevin Turcios
bfd9f2cd04 fix: respect test_index when creating optimization_features row
The get_or_create defaults passed test lists without positional
indexing, so when a higher test_index created the row first its
content landed at index 0 and was overwritten by the lower index
update, losing a test.
2026-02-23 03:36:50 -05:00
Kevin Turcios
6346d0992a chore: rename repo path env vars to match standard names
CODEFLASH_INTERNAL_REPO_PATH → AISERVICE_DIR, CODEFLASH_CLI_REPO_PATH → CODEFLASH_DIR
2026-02-23 03:36:50 -05:00
Kevin Turcios
af3185edff fix: handle non-numeric patch suffixes and support Python 3.15 2026-02-23 03:36:50 -05:00
Sarthak Agarwal
2cb3d51ddb
fix issue with closed and merged PRs raising suggestion (#2436) 2026-02-21 01:23:55 +05:30
Aseem Saxena
852274e2be
Merge branch 'main' into reduce-recompilations 2026-02-21 00:59:24 +05:30
aseembits93
85c5a2ec82 reduce rcompilations in the tests 2026-02-21 00:57:52 +05:30
Aseem Saxena
8f6d1d0602 fix: improve JIT testgen prompt to avoid error-checking tests
Add explicit guidance to avoid generating tests that check for specific
exception types, since JIT compilers (numba, torch.compile) produce
different error types than uncompiled code. This ensures generated tests
work consistently for both compiled and uncompiled versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 18:59:04 +00:00
Aseem Saxena
5553b01bc1
Merge branch 'main' into testgen-jit-iter 2026-02-21 00:06:44 +05:30
claude[bot]
4fa972edd3 refactor: remove unused TORCH_TENSOR_FUNCTIONS constant
Co-authored-by: Aseem Saxena <aseembits93@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 18:33:41 +00:00
Sarthak Agarwal
eb5f4b460e
Migrate to AWS bedrock (#2430)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1



Will require these for boto3 authentication
2026-02-20 23:52:48 +05:30
claude[bot]
46da033b05 style: fix ruff formatting and add mypy type annotation 2026-02-20 18:09:05 +00:00