euron-code 1.3.1__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {euron_code-1.3.1 → euron_code-1.4.0}/CHANGELOG.md +20 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/PKG-INFO +1 -1
- {euron_code-1.3.1 → euron_code-1.4.0}/pyproject.toml +1 -1
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/__init__.py +1 -1
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/agent.py +100 -8
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/llm/openai_compat.py +13 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/permissions.py +64 -3
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/progress.py +1 -1
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/prompts.py +8 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/fs.py +2 -1
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/fake_providers.py +6 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_bench_harness.py +44 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v11_byo.py +14 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v130_reliability.py +6 -1
- euron_code-1.4.0/tests/test_v140_parity.py +153 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/.gitignore +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/LICENSE +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/README.md +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/__main__.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/activity.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/api.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/attachments.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/auth.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/cache.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/cli.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/config.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/context.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/credentials.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/doctor.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/documents.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/hooks.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/keys.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/licensing.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/llm/base.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/logo.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/memory.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/osscache.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/repl.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/repomap.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/rules.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/sessions.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/skills.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/__init__.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/base.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/db.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/normalize.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/reuse.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/transcript.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/trust.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/ui.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/update_check.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/version_info.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/conftest.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/helpers.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/measure_floor.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/mock_gateway.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/serve_helper.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/sim_long_session.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_agent_mock.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_api_shell.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_bench.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_db.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_erie.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_markdown_view.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_oss_local.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_permissions.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_repl.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_search.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_textsafe.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_tools_fs.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_update_check.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v11_speed.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v31_security.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_activity.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_context.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v4.py +0 -0
- {euron_code-1.3.1 → euron_code-1.4.0}/tests/test_v5.py +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.0 (2026-11-09)
|
|
4
|
+
|
|
5
|
+
Fewer wasted steps and fewer missed details, from a benchmark of real student-style tasks with hidden tests.
|
|
6
|
+
|
|
7
|
+
- Checks you write are no longer blocked. In bypass mode (`--yolo`), test code passed inline (`python -c`,
|
|
8
|
+
`node -e`, a heredoc or a PowerShell here-string) was refused as "outside the project" when it contained a URL
|
|
9
|
+
route (`/products`), a `//` comment, a division or a `~~~` fence. Real paths outside the project (your home
|
|
10
|
+
folder, another drive, `..\..`) still ask, as before.
|
|
11
|
+
- Optional edge-case review before a detailed task is called done (`"specReview": true` in settings): Euron Code
|
|
12
|
+
tests the request's formats, error cases, empty and boundary input once more and fixes what fails. Off by
|
|
13
|
+
default, because on the Euron model it added steps without catching more.
|
|
14
|
+
- Running a check script and deleting it afterwards counts as checked: Euron Code no longer redoes the check.
|
|
15
|
+
`tsx` and `ts-node` script runs count as checks.
|
|
16
|
+
- A folder with only a few config files (package.json, README) is shown in the first step, so a new build does
|
|
17
|
+
not start by listing and reading them.
|
|
18
|
+
- `edit_file` / `multi_edit` without a path uses the one file you have already seen that holds the text.
|
|
19
|
+
- A step that only updates the task list gets a one-line hint to send todo updates with the next real step.
|
|
20
|
+
- Your own models whose tools only work with reasoning turned off on chat completions now work: Euron Code
|
|
21
|
+
learns that from the first error instead of dropping the tools.
|
|
22
|
+
|
|
3
23
|
## 1.3.1 (2026-11-09)
|
|
4
24
|
|
|
5
25
|
- A new build in an empty folder no longer gets the "here is every file in this small project" note (it only held
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students.
|
|
5
5
|
Project-URL: Homepage, https://euron.one/code-agent
|
|
6
6
|
Author-email: Euron <contact@euron.one>
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "euron-code"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.4.0"
|
|
8
8
|
description = "Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -236,6 +236,8 @@ class Agent:
|
|
|
236
236
|
self._reuse_nudged = False
|
|
237
237
|
self._calls: Dict[tuple, int] = {}
|
|
238
238
|
self._nudged = False
|
|
239
|
+
self._spec_reviewed = False # one rule-by-rule review of a detailed request before "done" (1.4.0)
|
|
240
|
+
self._todo_alone = 0 # steps whose only call was todo_write (1.4.0)
|
|
239
241
|
self.guard = progress.ProgressGuard() # loops, stalls, edit-revert cycles (1.3.0)
|
|
240
242
|
self._stuck = "" # why the guard stopped this request
|
|
241
243
|
self._done_nudges = 0
|
|
@@ -453,6 +455,8 @@ class Agent:
|
|
|
453
455
|
from euron_code import errorlog
|
|
454
456
|
errorlog.get().task_id = self.client.task_id
|
|
455
457
|
self._nudged = False
|
|
458
|
+
self._spec_reviewed = False
|
|
459
|
+
self._todo_alone = 0
|
|
456
460
|
self._placeholder_nudged = False
|
|
457
461
|
self._notice_nudged = False
|
|
458
462
|
for r in self._run_hooks("UserPromptSubmit", {"prompt": user_text}):
|
|
@@ -672,6 +676,11 @@ class Agent:
|
|
|
672
676
|
not done.startswith("[Euron Code: the last check") else
|
|
673
677
|
"(the last check still fails; asking Euron Code to fix it)")
|
|
674
678
|
continue
|
|
679
|
+
if self._needs_spec_review(user_text):
|
|
680
|
+
self._spec_reviewed = True
|
|
681
|
+
self._append({"role": "user", "content": prompts.SPEC_REVIEW_NUDGE})
|
|
682
|
+
self.ui.dim("(checking the result against your request once more)")
|
|
683
|
+
continue
|
|
675
684
|
open_todos = [t for t in self.ctx.todos if isinstance(t, dict)
|
|
676
685
|
and t.get("status") in ("pending", "in_progress")]
|
|
677
686
|
if (open_todos and self.ctx.todos != todos_at_start and not todo_nudged and not self.is_subagent
|
|
@@ -1171,6 +1180,13 @@ class Agent:
|
|
|
1171
1180
|
except KeyboardInterrupt:
|
|
1172
1181
|
content, outcome = "Interrupted by the user (Ctrl-C).", "interrupted"
|
|
1173
1182
|
content, looping = self._guard_repeats(tc, content)
|
|
1183
|
+
if (tc["function"]["name"] == "todo_write" and len(tool_calls) == 1
|
|
1184
|
+
and not content.startswith("Error")):
|
|
1185
|
+
self._todo_alone += 1
|
|
1186
|
+
if self._todo_alone >= 2:
|
|
1187
|
+
# bench 2026-11-09: 6 of 32 SWE steps were todo_write alone; each one is a full model round trip
|
|
1188
|
+
content += ("\n[Euron Code: a step with only todo_write costs a full round trip. Send todo "
|
|
1189
|
+
"updates together with your next real tool call, and do not tick items off at the end.]")
|
|
1174
1190
|
if self.pending_context and any(x.startswith("[Euron Code: you have edited") for x in self.pending_context):
|
|
1175
1191
|
content += "\n\n" + "\n".join(x for x in self.pending_context if x.startswith("[Euron Code: you have edited"))
|
|
1176
1192
|
self.pending_context = [x for x in self.pending_context if not x.startswith("[Euron Code: you have edited")]
|
|
@@ -1428,14 +1444,16 @@ class Agent:
|
|
|
1428
1444
|
def _done_nudge(self) -> Optional[str]:
|
|
1429
1445
|
"""Definition of done: after the last change a real check (build / tests / running it) must pass. Up
|
|
1430
1446
|
to MAX_DONE_NUDGES times the model is sent back: to run one, or to fix the one that fails."""
|
|
1431
|
-
if (self.is_subagent or self._done_nudges >= MAX_DONE_NUDGES or not self.
|
|
1447
|
+
if (self.is_subagent or self._done_nudges >= MAX_DONE_NUDGES or not self._real_edits()
|
|
1432
1448
|
or self.permissions.mode == "plan" or self.settings.get("verifyNudge", True) is False):
|
|
1433
1449
|
return None
|
|
1434
1450
|
if all(_DOC_RE.search(rel) for rel in self.files_changed()):
|
|
1435
1451
|
return None # docs / notes only: nothing to build
|
|
1436
1452
|
if self._verified():
|
|
1437
1453
|
return None
|
|
1438
|
-
last_edit =
|
|
1454
|
+
last_edit = self._last_edit_step()
|
|
1455
|
+
if last_edit is None:
|
|
1456
|
+
return None
|
|
1439
1457
|
after = [(c, code) for step, c, code in self.ledger["commands"] if step >= last_edit
|
|
1440
1458
|
and progress.is_check_command(c)]
|
|
1441
1459
|
if after and after[-1][1] != 0 and self._last_check:
|
|
@@ -1622,8 +1640,26 @@ class Agent:
|
|
|
1622
1640
|
"""About how many output tokens reused code saved: what was copied or adapted did not have to be written."""
|
|
1623
1641
|
return sum(self._reuse_chars.get((r, p), 0) for r, p, _ in self.ledger.get("reused") or []) // 4
|
|
1624
1642
|
|
|
1643
|
+
def _scratch(self, rel: str) -> bool:
|
|
1644
|
+
"""A file this session created and has deleted again (a _check.py): no change to the project."""
|
|
1645
|
+
path = self.root / rel
|
|
1646
|
+
try:
|
|
1647
|
+
return not path.exists() and self.ctx.tracker.created_here(path)
|
|
1648
|
+
except OSError:
|
|
1649
|
+
return False
|
|
1650
|
+
|
|
1651
|
+
def _real_edits(self) -> List[Tuple[int, str]]:
|
|
1652
|
+
return [(step, rel) for step, rel in self.ledger["edits"] if not self._scratch(rel)]
|
|
1653
|
+
|
|
1654
|
+
def _last_edit_step(self) -> Optional[int]:
|
|
1655
|
+
"""The step of the last change that stays in the project. Bench 2026-11-09: write _check.py, run it
|
|
1656
|
+
(pass), delete it; the delete counted as the last edit, so the check "had not run" and the model was
|
|
1657
|
+
sent to redo it (3 wasted steps)."""
|
|
1658
|
+
steps = [step for step, _ in self._real_edits()]
|
|
1659
|
+
return max(steps) if steps else None
|
|
1660
|
+
|
|
1625
1661
|
def files_changed(self) -> List[str]:
|
|
1626
|
-
return list(dict.fromkeys(rel for _, rel in self.
|
|
1662
|
+
return list(dict.fromkeys(rel for _, rel in self._real_edits()))
|
|
1627
1663
|
|
|
1628
1664
|
# ---------------------------------------------------------- tiny projects: every file in the first message
|
|
1629
1665
|
SNAPSHOT_MAX_FILES = 12
|
|
@@ -1659,8 +1695,12 @@ class Agent:
|
|
|
1659
1695
|
return ""
|
|
1660
1696
|
except OSError:
|
|
1661
1697
|
return ""
|
|
1662
|
-
|
|
1663
|
-
|
|
1698
|
+
# A new build in a folder of a few config files (package.json, README, tsconfig): show them with a
|
|
1699
|
+
# neutral note, since "make the change" confused new builds (live 1.3.0), but list_dir + read_file
|
|
1700
|
+
# of package.json cost two round trips (bench 2026-11-09, js-form-validation-rules).
|
|
1701
|
+
new_build = not any(_SOURCE_RE.search(p.name) for p in files)
|
|
1702
|
+
if not files:
|
|
1703
|
+
return ""
|
|
1664
1704
|
from euron_code.tools.fs import TO_END
|
|
1665
1705
|
blocks: List[str] = []
|
|
1666
1706
|
for p in files:
|
|
@@ -1675,6 +1715,9 @@ class Agent:
|
|
|
1675
1715
|
blocks.append(f'<project-file path="{self.ctx.rel(p)}">\n{body}\n</project-file>')
|
|
1676
1716
|
if not blocks:
|
|
1677
1717
|
return ""
|
|
1718
|
+
if new_build:
|
|
1719
|
+
return ("\n\n[The folder has no source code yet. These are all its files, as on disk now (you have read "
|
|
1720
|
+
"them; do not list or read them again):]\n" + "\n".join(blocks))
|
|
1678
1721
|
return ("\n\n[This project is small: here is every file in it, as on disk now (you have read them; do not "
|
|
1679
1722
|
"list or read them again). Make the change, run the tests once, and stop when they pass.]\n"
|
|
1680
1723
|
+ "\n".join(blocks))
|
|
@@ -1806,17 +1849,62 @@ class Agent:
|
|
|
1806
1849
|
return ", ".join(named[:6])
|
|
1807
1850
|
|
|
1808
1851
|
def _verified(self) -> bool:
|
|
1809
|
-
|
|
1852
|
+
last_edit = self._last_edit_step()
|
|
1853
|
+
if last_edit is None:
|
|
1810
1854
|
return True
|
|
1811
|
-
last_edit = max(step for step, _ in self.ledger["edits"])
|
|
1812
1855
|
# a real check (tests, build, running it) after the last change, and the latest one passed;
|
|
1813
1856
|
# 1.2.0 counted ANY exit 0, so `ls` after a broken build was "verified"
|
|
1814
1857
|
after = [code for step, c, code in self.ledger["commands"] if step >= last_edit
|
|
1815
1858
|
and progress.is_check_command(c)]
|
|
1816
1859
|
return bool(after) and after[-1] == 0
|
|
1817
1860
|
|
|
1861
|
+
def _infer_edit_path(self, args: Dict[str, Any]) -> Optional[str]:
|
|
1862
|
+
"""edit_file / multi_edit without `path` (bench 2026-11-09: a whole step lost to "Missing required
|
|
1863
|
+
parameter `path`"): when exactly ONE file this session read or wrote contains every old_string, it is
|
|
1864
|
+
that file. Never a guess between two files, never a file the model has not seen."""
|
|
1865
|
+
olds = [args.get("old_string")] if "edits" not in args else [
|
|
1866
|
+
e.get("old_string") for e in (args.get("edits") or []) if isinstance(e, dict)]
|
|
1867
|
+
olds = [o for o in olds if isinstance(o, str) and o.strip()]
|
|
1868
|
+
if not olds:
|
|
1869
|
+
return None
|
|
1870
|
+
seen = list(getattr(self.ctx.tracker, "files", {}).keys()) + [str(self.root / rel) for _, rel in
|
|
1871
|
+
self.ledger.get("edits") or []]
|
|
1872
|
+
hits: List[str] = []
|
|
1873
|
+
for key in dict.fromkeys(seen):
|
|
1874
|
+
path = Path(key)
|
|
1875
|
+
try:
|
|
1876
|
+
if not path.is_file() or path.stat().st_size > 2_000_000:
|
|
1877
|
+
continue
|
|
1878
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
1879
|
+
except OSError:
|
|
1880
|
+
continue
|
|
1881
|
+
if all(o.replace("\r\n", "\n") in text for o in olds): # read_text gives \n line ends
|
|
1882
|
+
rel = self.ctx.rel(path)
|
|
1883
|
+
if rel not in hits:
|
|
1884
|
+
hits.append(rel)
|
|
1885
|
+
return hits[0] if len(hits) == 1 else None
|
|
1886
|
+
|
|
1887
|
+
SPEC_REVIEW_MIN_CHARS = 350
|
|
1888
|
+
|
|
1889
|
+
def _needs_spec_review(self, user_text: str) -> bool:
|
|
1890
|
+
"""A detailed request (a spec with rules, formats, error cases) whose code changed and whose checks
|
|
1891
|
+
pass: one look back at the request, rule by rule, before calling it done. Bench 2026-11-09: most of
|
|
1892
|
+
Euron's hidden-test failures were a rule of the request missed after its own tests passed (a constant
|
|
1893
|
+
that must be lowercase only, whitespace inside an expression, sorting, a header, list inputs).
|
|
1894
|
+
OPT-IN (`"specReview": true`): measured on the self-hosted model it cost 6-10 steps and the model
|
|
1895
|
+
adjusted its own asserts to match its bug, so it is off by default."""
|
|
1896
|
+
if (self.is_subagent or self._spec_reviewed or self.permissions.mode == "plan"
|
|
1897
|
+
or self.settings.get("specReview", False) is not True or not self._real_edits()):
|
|
1898
|
+
return False
|
|
1899
|
+
text = re.sub(r'<attached-file path="[^"]*">.*?</attached-file>', " ", user_text or "", flags=re.S)
|
|
1900
|
+
if len(text.strip()) < self.SPEC_REVIEW_MIN_CHARS:
|
|
1901
|
+
return False
|
|
1902
|
+
if all(_DOC_RE.search(rel) for rel in self.files_changed()):
|
|
1903
|
+
return False
|
|
1904
|
+
return self._verified()
|
|
1905
|
+
|
|
1818
1906
|
def _needs_verify_nudge(self) -> bool:
|
|
1819
|
-
return (not self.is_subagent and not self._nudged and bool(self.
|
|
1907
|
+
return (not self.is_subagent and not self._nudged and bool(self._real_edits())
|
|
1820
1908
|
and self.permissions.mode != "plan" and self.settings.get("verifyNudge", True) is not False
|
|
1821
1909
|
and not self._verified())
|
|
1822
1910
|
|
|
@@ -1880,6 +1968,10 @@ class Agent:
|
|
|
1880
1968
|
args = normalize_args(args, getattr(tool, "parameters", None))
|
|
1881
1969
|
except Exception: # repairing is best effort; the tool still validates
|
|
1882
1970
|
pass
|
|
1971
|
+
if name in ("edit_file", "multi_edit") and isinstance(args, dict) and not args.get("path"):
|
|
1972
|
+
guess = self._infer_edit_path(args)
|
|
1973
|
+
if guess:
|
|
1974
|
+
args["path"] = guess
|
|
1883
1975
|
if cut is not None:
|
|
1884
1976
|
args["_partial"] = True # a file written in parts: no syntax check of its missing end
|
|
1885
1977
|
try:
|
|
@@ -40,6 +40,9 @@ class OpenAICompatBackend:
|
|
|
40
40
|
self._drop: set = set(cfg.get("dropParams") or [])
|
|
41
41
|
self._rename: Dict[str, str] = {}
|
|
42
42
|
self._drop_names = False # some servers reject `name` on tool messages
|
|
43
|
+
# OpenAI GPT-6 on chat/completions: "Function tools with reasoning_effort are not supported ... set
|
|
44
|
+
# reasoning_effort to 'none'" (2026-11-09). Learned once, then every request sends "none".
|
|
45
|
+
self._force_effort: Optional[str] = None
|
|
43
46
|
# api.Client compatibility (the agent sets these; they are not sent anywhere)
|
|
44
47
|
self.session_id: Optional[str] = None
|
|
45
48
|
self.task_id: Optional[str] = None
|
|
@@ -71,6 +74,8 @@ class OpenAICompatBackend:
|
|
|
71
74
|
if effort and (self.cfg.get("reasoningEffort") is True or
|
|
72
75
|
(self.official and _REASONING_MODEL.match(self.model))):
|
|
73
76
|
b["reasoning_effort"] = effort
|
|
77
|
+
if self._force_effort:
|
|
78
|
+
b["reasoning_effort"] = self._force_effort
|
|
74
79
|
if stream:
|
|
75
80
|
b["stream"] = True
|
|
76
81
|
b["stream_options"] = {"include_usage": True}
|
|
@@ -87,7 +92,14 @@ class OpenAICompatBackend:
|
|
|
87
92
|
"""Learn from a 400 about a parameter. True when the request should be sent again."""
|
|
88
93
|
if err.status not in (400, 422):
|
|
89
94
|
return False
|
|
95
|
+
low_msg = (err.message or "").lower()
|
|
96
|
+
if (not self._force_effort and "reasoning_effort" in low_msg
|
|
97
|
+
and re.search(r"set\W+reasoning_effort\W+to\W+.?none", low_msg)):
|
|
98
|
+
self._force_effort = "none"
|
|
99
|
+
return True
|
|
90
100
|
bad = base.unsupported_param(err.message, sent)
|
|
101
|
+
if bad in ("tools", "tool_choice"):
|
|
102
|
+
return False # without tools the agent cannot work: report the error instead of dropping them
|
|
91
103
|
if not bad:
|
|
92
104
|
low = (err.message or "").lower()
|
|
93
105
|
if not self._drop_names and "messages" in low and re.search(r"\bname\b", low):
|
|
@@ -174,6 +186,7 @@ class OpenAICompatBackend:
|
|
|
174
186
|
"""A second connection (parallel sub-agents), keeping what this one learned about the server."""
|
|
175
187
|
c = OpenAICompatBackend(self.provider, self.cfg, self.model, self._key, transport=self._transport)
|
|
176
188
|
c._drop, c._rename, c._drop_names = set(self._drop), dict(self._rename), self._drop_names
|
|
189
|
+
c._force_effort = self._force_effort
|
|
177
190
|
return c
|
|
178
191
|
|
|
179
192
|
def close(self) -> None:
|
|
@@ -185,7 +185,9 @@ DESTRUCTIVE = [re.compile(p, re.IGNORECASE) for p in (
|
|
|
185
185
|
r"\b(curl|wget|iwr|irm|Invoke-WebRequest|Invoke-RestMethod)\b[^|;]*\|\s*(iex|Invoke-Expression|python3?)\b",
|
|
186
186
|
)]
|
|
187
187
|
_WIN_SWITCH = re.compile(r"^/[A-Za-z?][A-Za-z0-9:]{0,3}$")
|
|
188
|
-
|
|
188
|
+
# `~` only as the home folder (`~`, `~/x`, `~user`): a Markdown fence `~~~` or `~=` inside inline code is not a path
|
|
189
|
+
# (bench 2026-11-09: `python -c "...~~~..."` was refused as "outside the project" in bypass mode).
|
|
190
|
+
_PATHLIKE = re.compile(r"^(?:[A-Za-z]:[\\/]|/|~(?:$|[\\/]|\w)|\\\\|\.\.(?:[\\/]|$)|\$HOME|\$\{HOME\}|\$env:USERPROFILE|%USERPROFILE%)")
|
|
189
191
|
|
|
190
192
|
|
|
191
193
|
def is_destructive(command: str) -> bool:
|
|
@@ -195,23 +197,82 @@ def is_destructive(command: str) -> bool:
|
|
|
195
197
|
def _expand(token: str) -> str:
|
|
196
198
|
t = token.strip().strip('"').strip("'")
|
|
197
199
|
t = re.sub(r"(?i)\$env:USERPROFILE", os.path.expanduser("~").replace("\\", "/"), t)
|
|
200
|
+
# $HOME is the home folder even where the variable is unset (Windows without Git Bash: expandvars left it
|
|
201
|
+
# literal, so `$HOME/.bashrc` looked like a path inside the project; CI 2026-11-09)
|
|
202
|
+
t = re.sub(r"^\$(?:HOME\b|\{HOME\})", lambda _m: os.path.expanduser("~").replace("\\", "/"), t)
|
|
198
203
|
return os.path.expandvars(os.path.expanduser(t))
|
|
199
204
|
|
|
200
205
|
|
|
206
|
+
#: Inline code passed to an interpreter (`python -c "..."`, `node -e '...'`, `npx tsx -e ...`). Inside it a
|
|
207
|
+
#: leading `/` is usually a URL route (`client.get('/products')`), a `//` comment or division, not a file.
|
|
208
|
+
_INLINE_CODE = re.compile(
|
|
209
|
+
r"""\b(?:python3?|py|node|tsx|deno\s+eval|ruby|perl|php)(?:\.exe)?\s+(?:-c|-e|--eval|-r)\s+"""
|
|
210
|
+
r"""("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')""", re.IGNORECASE | re.DOTALL)
|
|
211
|
+
#: Code carried in a shell here-document (`cat > t.py <<'EOF' ... EOF`) or a PowerShell here-string
|
|
212
|
+
#: (`@' ... '@ | Set-Content t.py`): its body is scanned like inline code; the command around it as usual.
|
|
213
|
+
_HEREDOC = re.compile(r"""<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1[^\n]*\n(.*?)\n\s*\2(?=\s|$)""", re.DOTALL)
|
|
214
|
+
_HERESTRING = re.compile(r"""@(['"])[ \t]*\r?\n(.*?)\r?\n\1@""", re.DOTALL)
|
|
215
|
+
_SLASH_RE = re.compile(r"^/+([^/\\\s'\"]*)")
|
|
216
|
+
_UNC_RE = re.compile(r"^\\\\[\w.-]+\\[\w$.-]+")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _rooted_slash_is_route(part: str) -> bool:
|
|
220
|
+
"""Inside inline code: `/`, `//...` and `/name...` whose first folder does not exist at the filesystem root
|
|
221
|
+
(`/products`, `/admin/users`) are routes or comments. `/etc/passwd`, `/home/x`, `/d/...` (Git Bash drive)
|
|
222
|
+
and anything under an existing top folder stay paths."""
|
|
223
|
+
if part.startswith("//") or part == "/":
|
|
224
|
+
return True
|
|
225
|
+
m = _SLASH_RE.match(part)
|
|
226
|
+
first = m.group(1) if m else ""
|
|
227
|
+
if not first:
|
|
228
|
+
return True
|
|
229
|
+
if os.name == "nt" and len(first) == 1 and first.isalpha():
|
|
230
|
+
return False # /c/Users/... is a drive path in Git Bash / MSYS
|
|
231
|
+
try:
|
|
232
|
+
return not (Path(Path.cwd().anchor or "/") / first).exists() and not Path("/" + first).exists()
|
|
233
|
+
except OSError:
|
|
234
|
+
return False
|
|
235
|
+
|
|
236
|
+
|
|
201
237
|
def outside_paths(command: str, roots: List[Path]) -> List[str]:
|
|
202
238
|
"""Absolute, `~` and $HOME / %USERPROFILE% paths a command names outside the project roots, the temp
|
|
203
239
|
folder and /dev, whether or not they exist (a missing ~/.ssh/id_rsa is still off limits)."""
|
|
204
240
|
import tempfile
|
|
205
241
|
allowed = [r.resolve() for r in roots] + [Path(tempfile.gettempdir()).resolve()]
|
|
206
242
|
found: List[str] = []
|
|
207
|
-
|
|
208
|
-
|
|
243
|
+
# Inline code is scanned on its own (strict about routes, see _rooted_slash_is_route); the rest of the
|
|
244
|
+
# command as before. A drive path, ~, $HOME or ..\ inside the code is still found.
|
|
245
|
+
inline = [m.group(3) for m in _HEREDOC.finditer(command)]
|
|
246
|
+
rest = _HEREDOC.sub(" ", command)
|
|
247
|
+
inline += [m.group(2) for m in _HERESTRING.finditer(rest)]
|
|
248
|
+
rest = _HERESTRING.sub(" ", rest)
|
|
249
|
+
inline += [m.group(1)[1:-1] for m in _INLINE_CODE.finditer(rest)]
|
|
250
|
+
rest = _INLINE_CODE.sub(" ", rest)
|
|
251
|
+
chunks = [(rest, False)] + [(c, True) for c in inline]
|
|
252
|
+
for text, in_code in chunks:
|
|
253
|
+
found += _outside_in(text, roots, allowed, in_code)
|
|
254
|
+
return found
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _outside_in(command: str, roots: List[Path], allowed: List[Path], in_code: bool) -> List[str]:
|
|
258
|
+
found: List[str] = []
|
|
259
|
+
if in_code: # code: split on anything that cannot be part of a path, so quotes/brackets/commas go
|
|
260
|
+
toks = [t for t in re.split(r"""[\s'"`(),;\[\]{}+*<>|&!?#]+""", command) if t]
|
|
261
|
+
segs = [toks]
|
|
262
|
+
else:
|
|
263
|
+
segs = [_tokens(seg) for seg in _segments(command.replace(">", " ").replace("<", " "))]
|
|
264
|
+
for seg_toks in segs:
|
|
265
|
+
for tok in seg_toks:
|
|
209
266
|
for part in [tok] + tok.split("=")[1:]:
|
|
210
267
|
# shlex keeps the quotes on Windows (posix=False), so a quoted path ("C:\x", "$env:USERPROFILE\x")
|
|
211
268
|
# was never seen as a path and skipped this guard (QA 2026-11-05)
|
|
212
269
|
part = part.strip().strip('"').strip("'")
|
|
213
270
|
if not _PATHLIKE.match(part) or (os.name == "nt" and _WIN_SWITCH.match(part)):
|
|
214
271
|
continue
|
|
272
|
+
if in_code and part.startswith("/") and _rooted_slash_is_route(part):
|
|
273
|
+
continue
|
|
274
|
+
if in_code and part.startswith("\\\\") and not _UNC_RE.match(part):
|
|
275
|
+
continue # "\\n" in a code string is an escaped newline, not \\server\share
|
|
215
276
|
if part.startswith("/dev/") or part in ("/dev/null", "NUL"):
|
|
216
277
|
continue
|
|
217
278
|
raw = _expand(part)
|
|
@@ -164,7 +164,7 @@ CHECK_RX = re.compile(
|
|
|
164
164
|
r"go (test|build|vet)|cargo (test|build|check)|mvn|gradle|dotnet (test|build)|rspec|phpunit|make)\b"
|
|
165
165
|
r"|\bnpm (run )?(test|build|lint|typecheck)\b|\b(pnpm|yarn|bun) (run )?(test|build|lint|typecheck)\b"
|
|
166
166
|
r"|\bnext build\b|\bvite build\b|\bnode --check\b"
|
|
167
|
-
r"|\b(python3?|py|node|deno|bun|ruby|php|go run)\s+[^|&;]*\.(py|js|mjs|cjs|ts|rb|php|go)\b"
|
|
167
|
+
r"|\b(python3?|py|node|deno|bun|ruby|php|go run|tsx|ts-node)\s+[^|&;]*\.(py|js|mjs|cjs|ts|rb|php|go)\b"
|
|
168
168
|
r"|\bpython3? -m (?!pip\b|venv\b|http\.server\b)[\w.]+|\b(python3?|py) -c\b|\bnode -e\b"
|
|
169
169
|
r"|\bcurl\b|\bInvoke-WebRequest\b", re.I)
|
|
170
170
|
NOT_CHECK_RX = re.compile(r"^\s*(ls|dir|cat|type|echo|mkdir|cd|pwd|git|pip3?|npm (i|install|ci)\b|uv pip|"
|
|
@@ -72,6 +72,14 @@ STUCK_NUDGE = ("[Euron Code: stop, you are not making progress ({why}). Do not c
|
|
|
72
72
|
"the file / line it points to, 3) what you already tried, 4) the ONE next step you recommend (a "
|
|
73
73
|
"different approach, not the same fix again). The user can say \"continue\" to go on.]")
|
|
74
74
|
|
|
75
|
+
SPEC_REVIEW_NUDGE = ("[Euron Code: before you finish, test the request's edge cases once. Go through the request rule "
|
|
76
|
+
"by rule from what you already have (do not re-read files) and write ONE short check script with "
|
|
77
|
+
"asserts for what your tests did not cover yet: exact names, return types and output format "
|
|
78
|
+
"(decimals, exact text, ordering, case); each error case; empty, blank, whitespace and boundary "
|
|
79
|
+
"input; other input types a caller may pass (plain lists instead of arrays, numeric strings); every "
|
|
80
|
+
"header, field or status code the request names; state that must reset on a retry. Run it, fix "
|
|
81
|
+
"what fails, delete the script. Then reply with your summary only (no checklist table).]")
|
|
82
|
+
|
|
75
83
|
CHECK_FAILED_NUDGE = ("[Euron Code: the last check still fails, so the task is not done: `{cmd}` exited {code}.\n"
|
|
76
84
|
"{tail}\nFix the cause (read the first error, the file and line it names) and run the check "
|
|
77
85
|
"again. If it cannot pass here (missing service, credentials, hardware), stop and say exactly "
|
|
@@ -569,7 +569,8 @@ class ReadFile(Tool):
|
|
|
569
569
|
class WriteFile(Tool):
|
|
570
570
|
name = "write_file"
|
|
571
571
|
description = (
|
|
572
|
-
'Create a new file or replace one completely
|
|
572
|
+
'Create a new file or replace one completely (missing folders are created; no mkdir needed). Prefer '
|
|
573
|
+
'edit_file for changes; read an existing file first. '
|
|
573
574
|
'A file over about 300 lines: write it in parts, the next part with append=true.'
|
|
574
575
|
)
|
|
575
576
|
parameters = {
|
|
@@ -111,6 +111,12 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
111
111
|
return self._json(400, {"error": {"message": "Unsupported parameter: 'max_tokens' is not supported "
|
|
112
112
|
"with this model. Use 'max_completion_tokens' instead.",
|
|
113
113
|
"type": "invalid_request_error"}})
|
|
114
|
+
if tag == "effortnone" and body.get("tools") and body.get("reasoning_effort") != "none":
|
|
115
|
+
# OpenAI GPT-6 on chat/completions (2026-11-09)
|
|
116
|
+
return self._json(400, {"error": {"message": "Function tools with reasoning_effort are not supported for "
|
|
117
|
+
"fake-coder in /v1/chat/completions. To use function tools, use "
|
|
118
|
+
"/v1/responses or set reasoning_effort to 'none'.",
|
|
119
|
+
"type": "invalid_request_error", "param": "reasoning_effort"}})
|
|
114
120
|
if tag == "busy" and "busy" not in st.once:
|
|
115
121
|
st.once.add("busy")
|
|
116
122
|
return self._json(503, {"error": {"message": "overloaded"}})
|
|
@@ -64,6 +64,40 @@ def test_claude_cut_off_run_is_priced_from_stream_usage():
|
|
|
64
64
|
assert (r.prompt_tokens, r.cached_tokens, r.completion_tokens) == (2_001_000, 1_000_000, 100_000)
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
def test_codex_cut_off_run_is_priced_from_rollout(tmp_path):
|
|
68
|
+
# killed before turn.completed: the rollout file of THIS working copy still has the running total
|
|
69
|
+
sess = tmp_path / "sessions" / "2026" / "11" / "09"
|
|
70
|
+
sess.mkdir(parents=True)
|
|
71
|
+
|
|
72
|
+
def rollout(name, cwd, total):
|
|
73
|
+
rows = [{"type": "session_meta", "payload": {"cwd": cwd}},
|
|
74
|
+
{"type": "event_msg", "payload": {"type": "token_count", "info": {"total_token_usage": total}}}]
|
|
75
|
+
(sess / name).write_text("\n".join(json.dumps(x) for x in rows), encoding="utf-8")
|
|
76
|
+
|
|
77
|
+
rollout("rollout-a.jsonl", "/other", {"input_tokens": 9_000_000, "cached_input_tokens": 0, "output_tokens": 0,
|
|
78
|
+
"total_tokens": 9_000_000})
|
|
79
|
+
rollout("rollout-b.jsonl", "/testbed", {"input_tokens": 1_000_000, "cached_input_tokens": 500_000,
|
|
80
|
+
"output_tokens": 100_000, "total_tokens": 1_100_000})
|
|
81
|
+
a = adapters.CodexAdapter(model="gpt-6.1-sol")
|
|
82
|
+
r = a.parse(_proc("", timed_out=True))
|
|
83
|
+
assert r.cost_usd is None
|
|
84
|
+
a.recover_usage(r, tmp_path, "/testbed")
|
|
85
|
+
# 0.5M uncached x 2 + 0.5M cached x 0.10 + 0.1M out x 10 = 1.0 + 0.05 + 1.0
|
|
86
|
+
assert r.cost_usd == pytest.approx(2.05) and r.cost_source.startswith("rollout")
|
|
87
|
+
assert (r.prompt_tokens, r.cached_tokens, r.completion_tokens) == (1_000_000, 500_000, 100_000)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def test_container_competitors_keep_keys_off_argv():
|
|
91
|
+
for cls in (adapters.ClaudeContainerAdapter, adapters.CodexContainerAdapter):
|
|
92
|
+
a = cls()
|
|
93
|
+
a.api_key = "sk-secret-value"
|
|
94
|
+
inv = a.invocation("fix it", "/testbed", 50, container=True)
|
|
95
|
+
assert inv.argv[0].startswith(adapters.TOOLS_DIR)
|
|
96
|
+
assert all("sk-secret-value" not in x for x in inv.argv)
|
|
97
|
+
assert any(k.endswith("_API_KEY") and v == "sk-secret-value" for k, v in inv.env.items())
|
|
98
|
+
assert adapters.ClaudeContainerAdapter().invocation("x", "/testbed", 5).env["IS_SANDBOX"] == "1"
|
|
99
|
+
|
|
100
|
+
|
|
67
101
|
def test_codex_default_model_is_priced():
|
|
68
102
|
a = adapters.CodexAdapter()
|
|
69
103
|
assert a.model in adapters.PRICING["openai"]
|
|
@@ -130,3 +164,13 @@ def test_example_task_grader_fails_untouched_and_passes_reference(tmp_path, monk
|
|
|
130
164
|
task = T.load_task(T.SETS / "euron-student" / "py-cart-discount-bugfix", "euron-student")
|
|
131
165
|
rows = runner.selftest([task], concurrency=1)
|
|
132
166
|
assert rows[0]["ok"], rows
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_euron_unreachable_gateway_is_network_not_an_agent_result():
|
|
170
|
+
err = {"type": "result", "error": {"message": "Cannot reach Euron Code at https://api.euron.one/api/v1/code-agent: "
|
|
171
|
+
"[Errno 11001] getaddrinfo failed (tried 4 times)."}}
|
|
172
|
+
r = adapters.EuronAdapter(api_key="x").parse(_proc(json.dumps(err), code=1))
|
|
173
|
+
assert r.agent_status == "network"
|
|
174
|
+
# the same text after real steps is a mid-task failure, scored as such
|
|
175
|
+
err["num_turns"] = 5
|
|
176
|
+
assert adapters.EuronAdapter(api_key="x").parse(_proc(json.dumps(err), code=1)).agent_status != "network"
|
|
@@ -142,6 +142,20 @@ def test_openai_unsupported_parameter_is_learned(providers):
|
|
|
142
142
|
b.close()
|
|
143
143
|
|
|
144
144
|
|
|
145
|
+
def test_gpt6_tools_need_reasoning_effort_none(providers):
|
|
146
|
+
b = llm.make_backend(llm.parse("fakeoa:fake-coder"), config.load_settings())
|
|
147
|
+
tools = [{"type": "function", "function": {"name": "read_file", "parameters": {"type": "object"}}}]
|
|
148
|
+
payload = {"messages": [{"role": "user", "content": "[byo:effortnone] hi"}], "tools": tools,
|
|
149
|
+
"tool_choice": "auto", "reasoning_effort": "medium"}
|
|
150
|
+
chunks = list(b.stream_chat(payload))
|
|
151
|
+
assert any((c.get("choices") or [{}])[0].get("delta", {}).get("content") for c in chunks if c.get("choices"))
|
|
152
|
+
last = providers.requests[-1]["body"]
|
|
153
|
+
assert last["tools"] and last["tool_choice"] == "auto" and last["reasoning_effort"] == "none"
|
|
154
|
+
assert len(providers.requests) == 2 # learned once
|
|
155
|
+
assert b.clone()._force_effort == "none"
|
|
156
|
+
b.close()
|
|
157
|
+
|
|
158
|
+
|
|
145
159
|
def test_model_without_tools_is_a_clear_error(providers, project):
|
|
146
160
|
a = byo_agent(project, "fakeoa:fake-coder")
|
|
147
161
|
res = a.run_turn("[byo:notools] hi")
|
|
@@ -277,7 +277,12 @@ def test_no_snapshot_for_a_new_build(project):
|
|
|
277
277
|
(project / "EURON.md").write_text("# p\n", encoding="utf-8")
|
|
278
278
|
(project / "notes.txt").write_text("x\n", encoding="utf-8")
|
|
279
279
|
a = Agent(C(), RecordingUI(interactive=False), project, dict(config.DEFAULTS), Permissions(project), "m")
|
|
280
|
-
|
|
280
|
+
snap = a._small_project_snapshot() # 1.4.0: config-only folder is shown with a neutral note, no "make the change"
|
|
281
|
+
assert "no source code yet" in snap and "notes.txt" in snap and "Make the change" not in snap
|
|
282
|
+
assert "EURON.md" not in snap
|
|
283
|
+
(project / "notes.txt").unlink()
|
|
284
|
+
(project / "EURON.md").unlink()
|
|
285
|
+
assert a._small_project_snapshot() == "" # an empty folder: nothing to show
|
|
281
286
|
(project / "app.js").write_text("let x = 1;\n", encoding="utf-8")
|
|
282
287
|
snap = a._small_project_snapshot()
|
|
283
288
|
assert "app.js" in snap and "EURON.md" not in snap
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""1.4.0 parity pass (bench 2026-11-09): bypass-guard false positives on inline code, the spec review
|
|
2
|
+
before "done", edit_file without a path, todo-only steps, and the near-empty-folder snapshot."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from euron_code.permissions import outside_paths
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _agent(project):
|
|
13
|
+
from euron_code import config
|
|
14
|
+
from euron_code.agent import Agent
|
|
15
|
+
from euron_code.permissions import Permissions
|
|
16
|
+
from helpers import RecordingUI
|
|
17
|
+
|
|
18
|
+
class C:
|
|
19
|
+
session_id = None
|
|
20
|
+
task_id = None
|
|
21
|
+
return Agent(C(), RecordingUI(interactive=False), project, dict(config.DEFAULTS), Permissions(project), "m")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# ------------------------------------------------------------------ bypass guard
|
|
25
|
+
|
|
26
|
+
ROUTES_AND_CODE = [
|
|
27
|
+
'''python -c "from app import app; c=TestClient(app); print(c.get('/zz-products?limit=5').json())"''',
|
|
28
|
+
'''node -e "// first check\nconsole.log(a / b)"''',
|
|
29
|
+
'''python -c "t='~~~\\n# x'"''',
|
|
30
|
+
'''npx tsx -e "import { x } from './src/utils'; console.log(x('/'))"''',
|
|
31
|
+
"cat > t.py <<'EOF'\nx = a / b\nprint('/zz-no-such-route/users')\nEOF\npython t.py",
|
|
32
|
+
"$c = @'\nx /= 2\nprint(1 / 2)\n'@ | Set-Content _c.py\npython _c.py",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.mark.parametrize("cmd", ROUTES_AND_CODE)
|
|
37
|
+
def test_inline_code_routes_and_comments_are_not_outside_paths(project, cmd):
|
|
38
|
+
assert outside_paths(cmd, [project]) == []
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
REAL_PATHS = [
|
|
42
|
+
'''python -c "open('~/.ssh/id_rsa').read()"''',
|
|
43
|
+
'''python -c "open('../../../../../../../../../../Windows/win.ini')"''',
|
|
44
|
+
'''python -c "open('$HOME/.bashrc')"''',
|
|
45
|
+
"cat > t.py <<'EOF'\nopen('~/.aws/credentials')\nEOF",
|
|
46
|
+
"cat > ~/x.py <<'EOF'\nprint(1)\nEOF",
|
|
47
|
+
"$c = @'\nopen('~/.ssh/id_rsa')\n'@ | Set-Content t.py",
|
|
48
|
+
"cat ~/.ssh/id_rsa",
|
|
49
|
+
"echo ~",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@pytest.mark.parametrize("cmd", REAL_PATHS)
|
|
54
|
+
def test_real_paths_inside_inline_code_are_still_caught(project, cmd):
|
|
55
|
+
assert outside_paths(cmd, [project]), cmd
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
WINDOWS_PATHS = [
|
|
59
|
+
'''python -c "import shutil; shutil.rmtree('C:/other' if 1 else '/x')"''',
|
|
60
|
+
'''python -c "print(1)" > C:/Windows/x.txt''',
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@pytest.mark.skipif(os.name != "nt", reason="drive letters")
|
|
65
|
+
@pytest.mark.parametrize("cmd", WINDOWS_PATHS)
|
|
66
|
+
def test_windows_drive_paths_inside_inline_code_are_still_caught(project, cmd):
|
|
67
|
+
assert outside_paths(cmd, [project]), cmd
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_triple_tilde_is_not_home_but_tilde_user_is(project):
|
|
71
|
+
assert outside_paths("echo ~~~", [project]) == []
|
|
72
|
+
assert outside_paths("ls ~root/x", [project])
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# ------------------------------------------------------------------ spec review
|
|
76
|
+
|
|
77
|
+
SPEC = ("Write calc.py with evaluate(expr). Rules: numbers, + - * /, parentheses, constants pi and e (lowercase "
|
|
78
|
+
"only), whitespace is ignored anywhere, raise CalcError for empty input, unknown names and division by "
|
|
79
|
+
"zero; the CLI prints whole numbers without decimals and others with format(x, '.10g'). " * 2)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_spec_review_only_for_a_detailed_request_with_passing_checks(project):
|
|
83
|
+
a = _agent(project)
|
|
84
|
+
(project / "calc.py").write_text("x = 1\n", encoding="utf-8")
|
|
85
|
+
a.ledger["edits"].append((1, "calc.py"))
|
|
86
|
+
a.ledger["commands"].append((2, "python -m pytest -q", 0))
|
|
87
|
+
assert not a._needs_spec_review(SPEC) # opt-in since the A/B (it cost steps on the self-hosted model)
|
|
88
|
+
a.settings["specReview"] = True
|
|
89
|
+
assert a._needs_spec_review(SPEC)
|
|
90
|
+
assert not a._needs_spec_review("fix the typo in calc.py") # short request: no review
|
|
91
|
+
a._spec_reviewed = True
|
|
92
|
+
assert not a._needs_spec_review(SPEC) # once per request
|
|
93
|
+
a._spec_reviewed = False
|
|
94
|
+
a.ledger["commands"].append((3, "python -m pytest -q", 1))
|
|
95
|
+
assert not a._needs_spec_review(SPEC) # failing check: the done nudge handles it
|
|
96
|
+
a.settings["specReview"] = False
|
|
97
|
+
a.ledger["commands"].append((4, "python -m pytest -q", 0))
|
|
98
|
+
assert not a._needs_spec_review(SPEC)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_no_spec_review_for_docs_only_or_no_edits(project):
|
|
102
|
+
a = _agent(project)
|
|
103
|
+
a.settings["specReview"] = True
|
|
104
|
+
assert not a._needs_spec_review(SPEC)
|
|
105
|
+
a.ledger["edits"].append((1, "README.md"))
|
|
106
|
+
assert not a._needs_spec_review(SPEC)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# ------------------------------------------------------------------ edit without a path
|
|
110
|
+
|
|
111
|
+
def test_edit_without_path_uses_the_one_seen_file_that_holds_the_text(project):
|
|
112
|
+
from euron_code.tools.fs import TO_END
|
|
113
|
+
a = _agent(project)
|
|
114
|
+
(project / "a.py").write_text("def f():\n return 1\n", encoding="utf-8")
|
|
115
|
+
(project / "b.py").write_text("def g():\n return 2\n", encoding="utf-8")
|
|
116
|
+
for p in ("a.py", "b.py"):
|
|
117
|
+
a.ctx.tracker.mark_read(project / p, (1, TO_END), 1, 10, None)
|
|
118
|
+
assert a._infer_edit_path({"old_string": "return 1", "new_string": "return 3"}) == "a.py"
|
|
119
|
+
assert a._infer_edit_path({"edits": [{"old_string": "def g", "new_string": "def h"}]}) == "b.py"
|
|
120
|
+
assert a._infer_edit_path({"old_string": "return", "new_string": "x"}) is None # two files: no guess
|
|
121
|
+
(project / "c.py").write_text("unseen = 1\n", encoding="utf-8")
|
|
122
|
+
assert a._infer_edit_path({"old_string": "unseen = 1", "new_string": "x"}) is None # never read
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# ------------------------------------------------------------------ snapshot of a config-only folder
|
|
126
|
+
|
|
127
|
+
def test_config_only_folder_is_shown_with_a_neutral_note(project):
|
|
128
|
+
(project / "package.json").write_text('{"scripts": {"test": "node --test"}}\n', encoding="utf-8")
|
|
129
|
+
snap = _agent(project)._small_project_snapshot()
|
|
130
|
+
assert "no source code yet" in snap and "package.json" in snap and "Make the change" not in snap
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# ------------------------------------------------------------------ scratch check files
|
|
134
|
+
|
|
135
|
+
def test_deleting_a_scratch_check_file_keeps_the_task_verified(project):
|
|
136
|
+
a = _agent(project)
|
|
137
|
+
(project / "calc.py").write_text("x = 1\n", encoding="utf-8")
|
|
138
|
+
a.ledger["edits"].append((1, "calc.py"))
|
|
139
|
+
scratch = project / "_check.py"
|
|
140
|
+
scratch.write_text("assert True\n", encoding="utf-8")
|
|
141
|
+
a.ctx.tracker.mark_written(scratch, created=True)
|
|
142
|
+
a.ledger["edits"].append((2, "_check.py"))
|
|
143
|
+
a.ledger["commands"].append((3, "python _check.py", 0))
|
|
144
|
+
scratch.unlink()
|
|
145
|
+
a.ledger["edits"].append((4, "_check.py")) # delete_file is recorded as an edit
|
|
146
|
+
assert a._verified() and a.files_changed() == ["calc.py"]
|
|
147
|
+
a.ledger["edits"].append((5, "calc.py")) # a real change after the check: not verified any more
|
|
148
|
+
assert not a._verified()
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def test_tsx_script_run_is_a_check():
|
|
152
|
+
from euron_code.progress import is_check_command
|
|
153
|
+
assert is_check_command("npx tsx _check.ts") and is_check_command("ts-node src/check.ts")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/build-from-reference/SKILL.md
RENAMED
|
File without changes
|
{euron_code-1.3.1 → euron_code-1.4.0}/src/euron_code/builtin_skills/explain-codebase/SKILL.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|