euron-code 1.8.0__tar.gz → 1.8.2__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.8.0 → euron_code-1.8.2}/CHANGELOG.md +30 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/PKG-INFO +1 -1
- {euron_code-1.8.0 → euron_code-1.8.2}/pyproject.toml +1 -1
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/__init__.py +1 -1
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/agent.py +292 -7
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/api.py +4 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/permissions.py +45 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/progress.py +31 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/prompts.py +17 -2
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/db.py +9 -2
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/normalize.py +29 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_db.py +1 -1
- euron_code-1.8.2/tests/test_v181_silent_failures_verified.py +124 -0
- euron_code-1.8.2/tests/test_v182_zero_errors.py +300 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/.gitignore +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/LICENSE +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/README.md +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/__main__.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/activity.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/attachments.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/auth.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/autoupdate.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/cache.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/checkpoints.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/cli.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/codeindex.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/config.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/context.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/contextforge/LICENSE +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/contextforge/__init__.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/contextforge/text.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/contextforge/toolout.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/credentials.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/ctxstats.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/doctor.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/documents.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/dotnet.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/error_hints.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/errorlog.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/failures.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/friendly.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/frontmatter.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/hooks.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/keys.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/knowledge.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/licensing.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/llm/__init__.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/llm/anthropic.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/llm/base.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/llm/openai_compat.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/llm/setup.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/logo.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/markdown_view.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/memory.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/migration.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/modes.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/mvc5.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/osscache.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/ossgithub.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/pasteinput.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/pathfix.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/project_setup.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/repl.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/repomap.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/rules.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/security_scan.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/sessions.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/skills.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/taskstate.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/textsafe.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tls.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/__init__.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/background.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/base.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/document.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/erie.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/fs.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/ignore.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/oss.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/pathfind.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/port.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/reuse.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/search.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/shell.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/skill.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/symbols.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/task.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/todo.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/web.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/tools/websearch.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/transcript.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/trust.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/ui.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/update_check.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/usage_view.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/version_info.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/src/euron_code/webforms.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/conftest.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/fake_providers.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/helpers.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/measure_floor.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/mock_gateway.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/serve_helper.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/sim_long_session.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_agent_mock.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_api_shell.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_bench.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_bench_harness.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_cli_e2e.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_context_memory_sessions.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_dashboard_fixes.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_dashboard_fixes_102.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_erie.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_knowledge_security.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_markdown_view.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_oss_local.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_permissions.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_powershell_exit_codes.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_qa_attach_secrets.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_qa_long_task.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_qa_print_output.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_qa_reuse_unrelated.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_qa_yolo_outside.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_repl.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_reuse_honesty.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_search.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_textsafe.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_tools_fs.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_transcript_ui.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_update_check.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v111_user_reports.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v113_fix_path.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v11_byo.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v11_speed.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v11_tool_fixes.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v130_cut_writes.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v130_reliability.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v140_parity.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v152_migration.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v153_user_errors.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v155_user_errors.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v156_autoupdate.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v156_paste_and_edits.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v157_zero_errors.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v15_hosted_models.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v15_reuse_off_subagent_hooks.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v160_stop_scope_atomic.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v161_residual_errors.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v170_v2.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v180_rescue_research_permissions.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v2_rules_skills_hooks.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v2_tokens_shortcuts.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v2_usage_headers.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v31_security.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_accounts_value_setup.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_activity.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_attachments.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_context.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_live_repl.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v3_single_login.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v4.py +0 -0
- {euron_code-1.8.0 → euron_code-1.8.2}/tests/test_v5.py +0 -0
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.2 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- **Does what it says it will do.** When an answer ends with "Let me check the files." (or "abhi fix karta hoon")
|
|
6
|
+
but nothing was run, Euron Code now sends it straight back to do it, in the same request. Before, you had to ask
|
|
7
|
+
"done?" and often got the same promise again. A go-ahead such as "continue", "y" or "proceed" now gets full
|
|
8
|
+
thinking (only "thanks"-style replies get a short answer).
|
|
9
|
+
- **Tests for what you asked, written first.** In a project with tests, a request to fix or add behaviour now starts
|
|
10
|
+
with a test for that behaviour, taken from your request (expected results, error cases, edge cases), and the change
|
|
11
|
+
is done when the tests pass. If no test was written, Euron Code asks for one once before it finishes. When its own
|
|
12
|
+
new test stays red after a fix attempt, a stronger helper model can step in sooner. Turn it off with
|
|
13
|
+
`"behaviourTests": false`.
|
|
14
|
+
- **No more failed steps after a cut-off tool call.** A tool call that hit the output limit could leave half-written
|
|
15
|
+
arguments in the conversation, and the helper model then refused the whole request. Euron Code now keeps the
|
|
16
|
+
conversation valid.
|
|
17
|
+
- **Plan mode can look around.** Read-only commands (`git log`, `git show`, `git fetch`, `ls`, `grep`, versions) run
|
|
18
|
+
in plan mode; anything that changes files is still blocked.
|
|
19
|
+
- Small fixes: a shell call whose argument name came through as `parameter=command` now runs; asking for a database
|
|
20
|
+
that is not set up says how to connect it instead of failing again and again.
|
|
21
|
+
|
|
22
|
+
## 1.8.1 (2026-11-14)
|
|
23
|
+
|
|
24
|
+
- **Gets help sooner when it is quietly stuck.** When the same test keeps failing the same way after a fix
|
|
25
|
+
attempt, or several steps change nothing while a check is red, Euron Code now tells Euron, so a stronger
|
|
26
|
+
helper model can step in. Before, only failed edits and empty answers counted, so a task could spin on a red
|
|
27
|
+
test for a long time.
|
|
28
|
+
- **"Verified" means the project's own checks passed.** In a project with its own tests or build, only those
|
|
29
|
+
(or a command you named in your request) count as verification after the last change. A helper script that
|
|
30
|
+
exits cleanly no longer marks a task "completed and verified" while a test still fails; Euron Code goes back
|
|
31
|
+
to the failing test instead.
|
|
32
|
+
|
|
3
33
|
## 1.8.0 (2026-11-14)
|
|
4
34
|
|
|
5
35
|
Finishes tasks faster, looks things up on the web, and stops asking what you already allowed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: euron-code
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2
|
|
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.8.
|
|
7
|
+
version = "1.8.2"
|
|
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"
|
|
@@ -25,7 +25,7 @@ from euron_code.api import (BusyError, ContextTooLongError, EuronError, Interrup
|
|
|
25
25
|
NetworkError, RateLimitedError)
|
|
26
26
|
from euron_code.checkpoints import Checkpoints
|
|
27
27
|
from euron_code.keys import EscWatcher
|
|
28
|
-
from euron_code.permissions import Permissions, Request
|
|
28
|
+
from euron_code.permissions import Permissions, Request, is_read_only_command
|
|
29
29
|
from euron_code.sessions import SessionWriter
|
|
30
30
|
from euron_code.tools import ToolContext, ToolError, ToolResult, default_tools, read_only_tools
|
|
31
31
|
from euron_code.tools.base import ReadTracker, Savings
|
|
@@ -124,6 +124,71 @@ _BIG_RE = re.compile(
|
|
|
124
124
|
r"redesign|overhaul|audit|module|modules|project|application|website|everything|25|dont stop|don't stop)\b", re.I)
|
|
125
125
|
|
|
126
126
|
|
|
127
|
+
#: a follow-up that only acknowledges (no work asked): answered with little reasoning. "continue", "y", "proceed",
|
|
128
|
+
#: "do it" are go-aheads and keep the normal effort (1.8.2: prod 13 Nov, low effort after a go-ahead answered
|
|
129
|
+
#: "Let me read the files." and stopped without reading anything, again and again)
|
|
130
|
+
ACK_ONLY = re.compile(r"^(thanks?( you)?|thx|ty|great|perfect|nice|cool|looks good|lgtm|good)[.!\s]*$", re.IGNORECASE)
|
|
131
|
+
|
|
132
|
+
#: the last sentence of an answer that announces work instead of doing it ("Let me read the files:")
|
|
133
|
+
_ANNOUNCE_RE = re.compile(
|
|
134
|
+
r"^(?:ok(?:ay)?[,.!]?\s+|sure[,.!]?\s+|yes[,.!]?\s+|sorry[^.!]*[.!]\s+|now[,]?\s+|next[,]?\s+|first[,]?\s+|then[,]?\s+)*"
|
|
135
|
+
r"(?:let me|let's|i'll|i will|i'm going to|i am going to|i need to|i'm now|i am now|i'll now|i will now|"
|
|
136
|
+
r"now i'll|now i will|now let me|starting|reading|checking|running|fixing|creating|writing|updating|looking)\b",
|
|
137
|
+
re.IGNORECASE)
|
|
138
|
+
_ANNOUNCE_HI_RE = re.compile(
|
|
139
|
+
r"\b(karta|karti|padhta|padhti|dekhta|dekhti|chalata|chalati|likhta|likhti|banata|banati)\s+(hoon|hu|hun)\b|"
|
|
140
|
+
r"\b(kar|padh|dekh|chala|likh|bana)\s+(raha|rahi)\s+(hoon|hu|hun)\b", re.IGNORECASE)
|
|
141
|
+
_ASKS_USER_RE = re.compile(
|
|
142
|
+
r"\b(tell me|let me know|once you|when you|if you|want me|would you|shall i|should i|do you want|you can|"
|
|
143
|
+
r"you need|you'll need|your call|reply|confirm|batao|bataiye|bata do)\b", re.IGNORECASE)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def announces_action(text: str) -> bool:
|
|
147
|
+
"""True when a text-only answer ends by announcing a step it did not take ("Let me check both sites.",
|
|
148
|
+
"Abhi fix karta hoon - reading all files ek saath:"). Prod 13 Nov 2026: 73 of 399 tasks with a captured answer
|
|
149
|
+
(12 of 24 people) ended this way; the person then had to ask "ho gaya?", "did you check", "??"."""
|
|
150
|
+
t = (text or "").strip()
|
|
151
|
+
if not t or len(t) > 700:
|
|
152
|
+
return False # long answers are reports, not announcements
|
|
153
|
+
t = re.sub(r"[*_`#>]+", "", t).strip()
|
|
154
|
+
parts = [p.strip() for p in re.split(r"(?<=[.!?])\s+|\n+", t) if p.strip()]
|
|
155
|
+
if not parts:
|
|
156
|
+
return False
|
|
157
|
+
last = parts[-1]
|
|
158
|
+
if "?" in last or _ASKS_USER_RE.search(last):
|
|
159
|
+
return False # it asks the person something: a fine place to stop
|
|
160
|
+
if last.endswith(":"):
|
|
161
|
+
return True
|
|
162
|
+
return bool(_ANNOUNCE_RE.match(last) or _ANNOUNCE_HI_RE.search(last))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#: test files: test_x.py, x_test.go, x.test.ts, x.spec.js, anything under tests/ or __tests__/
|
|
166
|
+
_TEST_PATH_RE = re.compile(r"(^|/)(tests?|__tests__|spec)/|(^|/)(test_[^/]*|[^/]*_test\.\w+|[^/]*\.(test|spec)\.\w+)$",
|
|
167
|
+
re.IGNORECASE)
|
|
168
|
+
#: requests where a new behaviour test does not apply: the tests are given, or it is UI / styling / ops / docs work
|
|
169
|
+
_NO_BEHAVIOUR_TEST_RE = re.compile(
|
|
170
|
+
r"(make|get) (all |the )?(\w+ )?tests? (to )?pass|do(n't| not) (edit|touch|change|modify) (the |any )?tests?|"
|
|
171
|
+
r"tests? (are|is) (given|provided|fixed)|no tests?\b|without tests?|"
|
|
172
|
+
r"failing tests?|tests? (are |is )?(failing|broken|red)|refactor|without changing (the |its |any )?behaviou?r|"
|
|
173
|
+
r"\b(css|scss|styl(e|es|ing)|design|ui|ux|layout|theme|colou?rs?|fonts?|spinner|animation|responsive|"
|
|
174
|
+
r"dockerfile|docker|readme|docs?|documentation|deploy|deployment|ci|pipeline|\.env|icons?|logo|images?)\b",
|
|
175
|
+
re.IGNORECASE)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def is_test_path(rel: str) -> bool:
|
|
179
|
+
return bool(_TEST_PATH_RE.search((rel or "").replace("\\", "/")))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def wants_behaviour_tests(text: str, tier: str) -> bool:
|
|
183
|
+
"""A code change whose behaviour a test can pin down (a fix, a feature, a rule): the agent writes the test from
|
|
184
|
+
the request first. Bench 2026-11-09/13: Euron's failures on hidden tests were a rule of the request missed while
|
|
185
|
+
its own checks passed."""
|
|
186
|
+
typed = re.sub(r"<attached-file\b[^>]*>.*?</attached-file>", " ", text or "", flags=re.S).strip()
|
|
187
|
+
if tier == "question" or not typed or not _CHANGE_RE.search(typed) or _NO_BEHAVIOUR_TEST_RE.search(typed):
|
|
188
|
+
return False
|
|
189
|
+
return len(typed) >= 25
|
|
190
|
+
|
|
191
|
+
|
|
127
192
|
def request_tier(text: str) -> str:
|
|
128
193
|
""""question", "small" or "large": how much budget a request gets, and whether it may change files."""
|
|
129
194
|
typed = re.sub(r"<attached-file\b[^>]*>.*?</attached-file>", " ", text or "", flags=re.S)
|
|
@@ -213,6 +278,57 @@ def repair_json(raw: str):
|
|
|
213
278
|
raise ValueError("not valid JSON")
|
|
214
279
|
|
|
215
280
|
|
|
281
|
+
_PATH_ARG_RE = re.compile(r'"(?:path|file_path|filePath)"\s*:\s*"((?:[^"\\]|\\.){1,400})"')
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _cut_stub(raw: str) -> str:
|
|
285
|
+
"""Valid JSON for a tool call the output limit cut off (it is not run). The cut text stayed in the history
|
|
286
|
+
before 1.8.2, and a provider that parses the history rejected the whole request (prod 13 Nov: the rescue model
|
|
287
|
+
answered 400 "Unterminated string starting at: line 1 column 13", so the step failed)."""
|
|
288
|
+
m = _PATH_ARG_RE.search(raw or "")
|
|
289
|
+
stub: Dict[str, Any] = {"_cut": "these arguments were cut off by the output limit; the call was not run"}
|
|
290
|
+
if m:
|
|
291
|
+
try:
|
|
292
|
+
stub = {"path": json.loads('"' + m.group(1) + '"'), **stub}
|
|
293
|
+
except ValueError:
|
|
294
|
+
pass
|
|
295
|
+
return json.dumps(stub)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def valid_history(messages: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
299
|
+
"""The messages with every assistant tool call's `arguments` as valid JSON (a copy only where needed). A model
|
|
300
|
+
can write broken JSON; the Euron model accepts it, but other providers (the rescue model, your own model) reject the request."""
|
|
301
|
+
out: Optional[List[Dict[str, Any]]] = None
|
|
302
|
+
for i, m in enumerate(messages):
|
|
303
|
+
calls = m.get("tool_calls") if m.get("role") == "assistant" else None
|
|
304
|
+
if not calls:
|
|
305
|
+
continue
|
|
306
|
+
fixed = None
|
|
307
|
+
for j, tc in enumerate(calls):
|
|
308
|
+
fn = (tc or {}).get("function") or {}
|
|
309
|
+
raw = fn.get("arguments")
|
|
310
|
+
if not isinstance(raw, str) or not raw.strip():
|
|
311
|
+
good = json.dumps(raw) if isinstance(raw, dict) else "{}"
|
|
312
|
+
else:
|
|
313
|
+
try:
|
|
314
|
+
json.loads(raw)
|
|
315
|
+
continue
|
|
316
|
+
except ValueError:
|
|
317
|
+
try:
|
|
318
|
+
val = repair_json(raw)
|
|
319
|
+
good = json.dumps(val if isinstance(val, dict) else {"value": val})
|
|
320
|
+
except ValueError:
|
|
321
|
+
good = _cut_stub(raw)
|
|
322
|
+
if fixed is None:
|
|
323
|
+
fixed = list(calls)
|
|
324
|
+
fixed[j] = {**fixed[j], "function": {**fn, "arguments": good}}
|
|
325
|
+
if fixed is not None:
|
|
326
|
+
if out is None:
|
|
327
|
+
out = list(messages)
|
|
328
|
+
out[i] = {**m, "tool_calls": fixed}
|
|
329
|
+
return messages if out is None else out
|
|
330
|
+
|
|
331
|
+
|
|
216
332
|
#: placeholder text a generated file must not keep when the user gave real details
|
|
217
333
|
PLACEHOLDER_RE = re.compile(r"Your Name|Lorem ipsum|example@example\.com|TODO: replace", re.I)
|
|
218
334
|
#: form hints such as placeholder="Your name" are correct UI text, not leftover template content
|
|
@@ -346,6 +462,17 @@ class Agent:
|
|
|
346
462
|
self._stall_done = 0
|
|
347
463
|
self._rescue_steps = 0
|
|
348
464
|
self._handback_due = False
|
|
465
|
+
# 1.8.1: model-shaped failures the gateway cannot see in the messages (X-Euron-Signal): the same check red
|
|
466
|
+
# again after a fix attempt, and steps that change nothing while the last check is red
|
|
467
|
+
self._signal: Optional[str] = None
|
|
468
|
+
self._last_red: Dict[str, Tuple[str, int]] = {}
|
|
469
|
+
self._nodiff_red = 0
|
|
470
|
+
self._has_suite: Optional[bool] = None
|
|
471
|
+
self._has_tests: Optional[bool] = None
|
|
472
|
+
# 1.8.2: a code change a test can pin down: the test comes from the request first, and a red own test after
|
|
473
|
+
# a fix attempt is a model-shaped failure (the "passes its own checks, fails the hidden tests" gap)
|
|
474
|
+
self._behaviour = False
|
|
475
|
+
self._test_nudged = False
|
|
349
476
|
self.last_status: Optional[Dict[str, Any]] = None # the last task's decided status + evidence
|
|
350
477
|
self._job_diff = ""
|
|
351
478
|
self._adopt_fails = 0
|
|
@@ -570,6 +697,11 @@ class Agent:
|
|
|
570
697
|
resume_cp = self._job_for(user_text)
|
|
571
698
|
if resume_cp is not None and resume_cp.get("tier") in TIER_BUDGETS:
|
|
572
699
|
tier = resume_cp["tier"] if resume_cp["tier"] != "question" else "small"
|
|
700
|
+
follow_up = bool(SIMPLE_FOLLOWUP.match(user_text.strip())) or resume_cp is not None
|
|
701
|
+
if not follow_up:
|
|
702
|
+
self._behaviour = (self.settings.get("behaviourTests", True) is not False and self.mode != "economy"
|
|
703
|
+
and wants_behaviour_tests(user_text, tier) and self._project_has_tests())
|
|
704
|
+
self._test_nudged = False
|
|
573
705
|
self._tier = tier
|
|
574
706
|
self._checks = []
|
|
575
707
|
self._last_ok_action = ""
|
|
@@ -578,6 +710,9 @@ class Agent:
|
|
|
578
710
|
self._budget_kind = "step_budget"
|
|
579
711
|
self._stall_s = 0.0
|
|
580
712
|
self._stall_files = set()
|
|
713
|
+
self._signal = None
|
|
714
|
+
self._last_red = {}
|
|
715
|
+
self._nodiff_red = 0
|
|
581
716
|
self._stall_done = sum(1 for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed")
|
|
582
717
|
self._done_at_window = sum(1 for t in self.ctx.todos if isinstance(t, dict) and t.get("status") == "completed")
|
|
583
718
|
self._job_diff = (resume_cp or {}).get("diff") or ""
|
|
@@ -664,7 +799,8 @@ class Agent:
|
|
|
664
799
|
return [c for c in self._checks if last_edit is None or c[0] >= last_edit]
|
|
665
800
|
|
|
666
801
|
def _evidence(self, result: Optional[TurnResult]) -> Dict[str, Any]:
|
|
667
|
-
|
|
802
|
+
own = [c for c in self._checks if self._verifying(c[1])] # 1.8.1: the project's own checks decide
|
|
803
|
+
last = own[-1] if own else (self._checks[-1] if self._checks else None)
|
|
668
804
|
return {"stop_reason": result.stop_reason if result else "error", "error": result.error if result else None,
|
|
669
805
|
"edits": bool(self._real_edits()), "verified": bool(self._real_edits()) and self._verified(),
|
|
670
806
|
"last_check": (last[1], last[2], last[3]) if last else None,
|
|
@@ -727,6 +863,7 @@ class Agent:
|
|
|
727
863
|
self._budget_used = (result.turns if result else 0, max(0.0, time.monotonic() - self._turn_started
|
|
728
864
|
- (WAIT_CLOCK.total - self._turn_waited)))
|
|
729
865
|
after = self._checks_after_edit() if self._real_edits() else self._checks
|
|
866
|
+
after = [c for c in after if self._verifying(c[1])] or after
|
|
730
867
|
last = after[-1] if after else None
|
|
731
868
|
verification = {"command": taskstate.clean_command(last[1], self.root) if last else "",
|
|
732
869
|
"exitCode": last[2] if last else None, "kind": taskstate.check_kind(last[1]) if last else "none"}
|
|
@@ -804,6 +941,9 @@ class Agent:
|
|
|
804
941
|
if not self.is_subagent:
|
|
805
942
|
text += self._build_context(user_text)
|
|
806
943
|
text += self._migration_context(user_text)
|
|
944
|
+
if (self._behaviour and self.permissions.mode != "plan" and not self._resumed
|
|
945
|
+
and not SIMPLE_FOLLOWUP.match(user_text.strip())):
|
|
946
|
+
text += "\n\n" + prompts.TEST_FIRST_NOTE
|
|
807
947
|
snap = self._small_project_snapshot() if len(self.messages) == 1 else ""
|
|
808
948
|
text += snap
|
|
809
949
|
if not snap and not self._resumed and not SIMPLE_FOLLOWUP.match(user_text.strip()) \
|
|
@@ -836,10 +976,11 @@ class Agent:
|
|
|
836
976
|
|
|
837
977
|
def _loop(self, max_turns: Optional[int], user_text: str) -> TurnResult:
|
|
838
978
|
self.cancel.clear()
|
|
839
|
-
self._turn_effort = "low" if
|
|
979
|
+
self._turn_effort = "low" if ACK_ONLY.match(user_text.strip()) and len(self.messages) > 2 else None
|
|
840
980
|
turns = 0
|
|
841
981
|
last_text = ""
|
|
842
982
|
stop_feedback = 0
|
|
983
|
+
act_nudges = 0 # 1.8.2: "Let me read the files." with no tool call: sent back to do it
|
|
843
984
|
step_budget = int(self.settings.get("maxStepsPerPrompt") or DEFAULT_STEP_BUDGET)
|
|
844
985
|
if not self.is_subagent and step_budget == DEFAULT_STEP_BUDGET: # a limit the person set always wins
|
|
845
986
|
base_steps = self.base_budget()[0]
|
|
@@ -962,6 +1103,16 @@ class Agent:
|
|
|
962
1103
|
stop_feedback += 1
|
|
963
1104
|
self._append({"role": "user", "content": feedback})
|
|
964
1105
|
continue
|
|
1106
|
+
if (act_nudges < 2 and not self.is_subagent and resp.finish_reason != "length"
|
|
1107
|
+
and self.settings.get("actNudge", True) is not False
|
|
1108
|
+
and announces_action(partial + resp.content)):
|
|
1109
|
+
# prod 13 Nov: 18% of answered tasks ended on "Let me check both sites." with nothing run; the
|
|
1110
|
+
# person had to ask "ho gaya?" / "did you check" (and often got the same announcement again)
|
|
1111
|
+
act_nudges += 1
|
|
1112
|
+
self._append({"role": "user", "content": prompts.ACT_NUDGE})
|
|
1113
|
+
self._effort_once = None
|
|
1114
|
+
self.ui.dim("(Euron Code said what it would do next but did not do it; asking it to do it now)")
|
|
1115
|
+
continue
|
|
965
1116
|
where = self._placeholders() if not self._placeholder_nudged and not self.is_subagent else ""
|
|
966
1117
|
if where:
|
|
967
1118
|
self._placeholder_nudged = True
|
|
@@ -1243,7 +1394,7 @@ class Agent:
|
|
|
1243
1394
|
max_tokens = max(min(OUTPUT_FLOOR, max(256, room)), min(self.max_output, room))
|
|
1244
1395
|
payload = {
|
|
1245
1396
|
"model": self.model,
|
|
1246
|
-
"messages": self.messages,
|
|
1397
|
+
"messages": valid_history(self.messages),
|
|
1247
1398
|
"tools": cap_tools(self.tool_schemas),
|
|
1248
1399
|
"tool_choice": getattr(self, "_tool_choice_once", None) or "auto",
|
|
1249
1400
|
"max_tokens": max_tokens,
|
|
@@ -1479,6 +1630,7 @@ class Agent:
|
|
|
1479
1630
|
self._maybe_handback()
|
|
1480
1631
|
if hasattr(self.llm, "stall_sec") and getattr(self.llm, "is_euron", False):
|
|
1481
1632
|
self.llm.stall_sec = int(self._stall_s)
|
|
1633
|
+
self.llm.signal, self._signal = self._signal, None
|
|
1482
1634
|
payload = self._payload()
|
|
1483
1635
|
if not self.is_subagent:
|
|
1484
1636
|
self.ctxstats.observe(self.messages[1:])
|
|
@@ -1694,6 +1846,7 @@ class Agent:
|
|
|
1694
1846
|
"""Run one step's tool calls. Edits in one step are all-or-nothing (1.6.0): when one of several edits
|
|
1695
1847
|
fails, the others of that step are undone, so no file (or pair of files) is left half-changed."""
|
|
1696
1848
|
edits = [tc for tc in tool_calls if (tc.get("function") or {}).get("name") in EDIT_TOOLS]
|
|
1849
|
+
edits_before = len(self._real_edits())
|
|
1697
1850
|
self._step_journal = {} if len(edits) >= 2 else None
|
|
1698
1851
|
self._step_failed_ids = set()
|
|
1699
1852
|
out: List[Dict[str, Any]] = []
|
|
@@ -1708,6 +1861,7 @@ class Agent:
|
|
|
1708
1861
|
self._settle_step(out, journal)
|
|
1709
1862
|
for m in out:
|
|
1710
1863
|
self._append(m)
|
|
1864
|
+
self._note_step_diff(edits_before)
|
|
1711
1865
|
if self.settings.get("supersedeStaleReads") == "always":
|
|
1712
1866
|
self._supersede_stale_reads()
|
|
1713
1867
|
return stop
|
|
@@ -2031,8 +2185,10 @@ class Agent:
|
|
|
2031
2185
|
saved += lines
|
|
2032
2186
|
continue
|
|
2033
2187
|
self._cut_calls[cid] = ("skip", prompts.CUT_WRITE_SKIPPED.format(path=path or "the file", kb=kb))
|
|
2188
|
+
fn["arguments"] = _cut_stub(raw)
|
|
2034
2189
|
continue
|
|
2035
2190
|
self._cut_calls[cid] = ("skip", prompts.CUT_TOOL_NUDGE)
|
|
2191
|
+
fn["arguments"] = _cut_stub(raw)
|
|
2036
2192
|
self._effort_once = "low" # the next step is mechanical: keep writing
|
|
2037
2193
|
return saved
|
|
2038
2194
|
|
|
@@ -2050,6 +2206,7 @@ class Agent:
|
|
|
2050
2206
|
cls = failures.from_output(content, taskstate.check_kind(command) == "tests") if code else None
|
|
2051
2207
|
self._checks.append((self.steps, command or name, code, cls))
|
|
2052
2208
|
self._last_check_out = content if code else ""
|
|
2209
|
+
self._note_red(command or name, code, cls, content)
|
|
2053
2210
|
if not failed and req is not None and name not in ("todo_write",):
|
|
2054
2211
|
what = (req.command or "") if name == "bash" else ", ".join(self.ctx.rel(p) for p in req.paths[:3])
|
|
2055
2212
|
self._last_ok_action = f"step {self.steps}: {name} {what}".strip()[:200]
|
|
@@ -2197,15 +2354,22 @@ class Agent:
|
|
|
2197
2354
|
return None
|
|
2198
2355
|
if all(_DOC_RE.search(rel) or _NO_BUILD_RE.search(rel) for rel in self.files_changed()):
|
|
2199
2356
|
return None # docs / notes / plain CSS / images only: nothing to build (1.8.0: no extra steps for these)
|
|
2357
|
+
if (self._behaviour and not self._test_nudged and not self._own_tests()
|
|
2358
|
+
and any(_SOURCE_RE.search(rel) and not _NO_BUILD_RE.search(rel) for rel in self.files_changed())):
|
|
2359
|
+
# the change has no test of the requested behaviour: one ask, then the usual check gate
|
|
2360
|
+
self._test_nudged = True
|
|
2361
|
+
return prompts.TEST_ADD_NUDGE
|
|
2200
2362
|
if self._verified():
|
|
2201
2363
|
return None
|
|
2202
2364
|
last_edit = self._last_edit_step()
|
|
2203
2365
|
if last_edit is None:
|
|
2204
2366
|
return None
|
|
2205
2367
|
after = [(c, code) for step, c, code in self.ledger["commands"] if step >= last_edit
|
|
2206
|
-
and
|
|
2368
|
+
and self._verifying(c)]
|
|
2207
2369
|
if after and after[-1][1] != 0 and self._last_check:
|
|
2208
2370
|
cmd, code, tail = self._last_check
|
|
2371
|
+
if cmd != after[-1][0]: # a helper ran after the red check: report the project's own check
|
|
2372
|
+
cmd, code, tail = after[-1][0], after[-1][1], ""
|
|
2209
2373
|
return prompts.CHECK_FAILED_NUDGE.format(cmd=cmd[:160], code=code, tail=tail[:900] or "(no output)") \
|
|
2210
2374
|
+ self._diagnosis()
|
|
2211
2375
|
if self._nudged:
|
|
@@ -2775,9 +2939,128 @@ class Agent:
|
|
|
2775
2939
|
# a real check (tests, build, running it) after the last change, and the latest one passed;
|
|
2776
2940
|
# 1.2.0 counted ANY exit 0, so `ls` after a broken build was "verified"
|
|
2777
2941
|
after = [code for step, c, code in self.ledger["commands"] if step >= last_edit
|
|
2778
|
-
and
|
|
2942
|
+
and self._verifying(c)]
|
|
2779
2943
|
return bool(after) and after[-1] == 0
|
|
2780
2944
|
|
|
2945
|
+
# ---------------------------------------------------------- 1.8.1: what counts as verification, red signals
|
|
2946
|
+
def _project_has_suite(self) -> bool:
|
|
2947
|
+
"""The project has its own tests / build / lint (then only those verify a change, not a script run)."""
|
|
2948
|
+
if self._has_suite is None:
|
|
2949
|
+
found = False
|
|
2950
|
+
try:
|
|
2951
|
+
pkg = self.root / "package.json"
|
|
2952
|
+
if pkg.is_file():
|
|
2953
|
+
scripts = (json.loads(pkg.read_text(encoding="utf-8", errors="replace") or "{}").get("scripts") or {})
|
|
2954
|
+
found = any(k in scripts for k in ("test", "build", "lint", "typecheck"))
|
|
2955
|
+
if not found:
|
|
2956
|
+
n = 0
|
|
2957
|
+
for p in self.root.rglob("*"):
|
|
2958
|
+
n += 1
|
|
2959
|
+
if n > 4000:
|
|
2960
|
+
break
|
|
2961
|
+
if any(part in ("node_modules", ".git", ".venv", "venv", "__pycache__") for part in p.parts):
|
|
2962
|
+
continue
|
|
2963
|
+
nm = p.name.lower()
|
|
2964
|
+
if p.is_file() and (re.match(r"test_.*\.py$|.*_test\.(py|go)$|.*\.(test|spec)\.[jt]sx?$", nm)
|
|
2965
|
+
or nm in ("pytest.ini", "tox.ini", "makefile", "cargo.toml", "go.mod",
|
|
2966
|
+
"pom.xml", "build.gradle")):
|
|
2967
|
+
found = True
|
|
2968
|
+
break
|
|
2969
|
+
except (OSError, ValueError):
|
|
2970
|
+
found = False
|
|
2971
|
+
self._has_suite = found
|
|
2972
|
+
return self._has_suite
|
|
2973
|
+
|
|
2974
|
+
def _verifying(self, command: str) -> bool:
|
|
2975
|
+
"""A command that verifies the change: the project's own tests / build / lint / type check, or the command
|
|
2976
|
+
the user named. A run of a helper script does not (1.8.0 reported "completed and verified" after
|
|
2977
|
+
`python find_hash.py` exited 0 while the project's test still failed). Without a test suite in the
|
|
2978
|
+
project, running the program the task changed still counts."""
|
|
2979
|
+
c = (command or "").strip()
|
|
2980
|
+
if not c or not progress.is_check_command(c):
|
|
2981
|
+
return False
|
|
2982
|
+
segs = [s.strip() for s in re.split(r"\s*(?:&&|;|\|\|)\s*", c) if s.strip()]
|
|
2983
|
+
asked = (self._objective or "").lower()
|
|
2984
|
+
for s in segs:
|
|
2985
|
+
if len(s) >= 4 and s.lower() in asked:
|
|
2986
|
+
return True # the user named this command
|
|
2987
|
+
if progress.is_suite_command(s):
|
|
2988
|
+
return True
|
|
2989
|
+
m = re.search(r"([\w.\\/-]+\.(?:py|js|mjs|cjs|ts|tsx|go))\b", s)
|
|
2990
|
+
if m and re.match(r"(test_.*|.*_test|.*\.(test|spec))\.\w+$", m.group(1).replace("\\", "/").split("/")[-1], re.I):
|
|
2991
|
+
return True # running one of the project's test files directly
|
|
2992
|
+
# A project with its own tests / build: only those verify. Without one, a passing check run (a scratch
|
|
2993
|
+
# script with asserts, running the program, a request to it) is the best evidence there is.
|
|
2994
|
+
return not self._project_has_suite()
|
|
2995
|
+
|
|
2996
|
+
def _note_red(self, command: str, code: int, cls: Optional[str], content: str) -> None:
|
|
2997
|
+
"""The same check red again, the same way, after the model tried a fix: a model-shaped failure."""
|
|
2998
|
+
key = re.sub(r"\s+", " ", (command or "").strip().lower())[:200]
|
|
2999
|
+
if code == 0:
|
|
3000
|
+
self._last_red.pop(key, None)
|
|
3001
|
+
self._nodiff_red = 0
|
|
3002
|
+
return
|
|
3003
|
+
if failures.blocks(cls) or cls in ("dependency_failure", "ssl_certificate", "environment_config",
|
|
3004
|
+
"permission_failure"):
|
|
3005
|
+
return # environment / setup: a stronger model does not fix it
|
|
3006
|
+
sig = progress.failure_signature(content)
|
|
3007
|
+
prev = self._last_red.get(key)
|
|
3008
|
+
edited_since = prev is not None and any(st > prev[1] for st, _ in self._real_edits())
|
|
3009
|
+
if prev is not None and prev[0] == sig and edited_since:
|
|
3010
|
+
self._signal = "compilation_failure" if cls == "compilation_failure" else "test_failure"
|
|
3011
|
+
elif prev is not None and self._own_red(content, prev[1]):
|
|
3012
|
+
# 1.8.2: a test the agent wrote for this request is still red after it changed the code: the failure
|
|
3013
|
+
# may look different each time, but the requested behaviour is still wrong
|
|
3014
|
+
self._signal = "test_failure"
|
|
3015
|
+
self._last_red[key] = (sig, self.steps)
|
|
3016
|
+
|
|
3017
|
+
def _own_tests(self) -> List[str]:
|
|
3018
|
+
"""Test files this request created or changed."""
|
|
3019
|
+
return [rel for rel in self.files_changed() if is_test_path(rel)]
|
|
3020
|
+
|
|
3021
|
+
def _own_red(self, content: str, since_step: int) -> bool:
|
|
3022
|
+
"""A red run names one of this request's own tests, and a non-test file changed since the last red run."""
|
|
3023
|
+
own = self._own_tests()
|
|
3024
|
+
if not own or not any(st > since_step and not is_test_path(rel) for st, rel in self._real_edits()):
|
|
3025
|
+
return False
|
|
3026
|
+
text = content or ""
|
|
3027
|
+
return any(Path(rel).name in text or Path(rel).stem in text for rel in own)
|
|
3028
|
+
|
|
3029
|
+
def _project_has_tests(self) -> bool:
|
|
3030
|
+
"""The project already has test FILES (a test script or a config alone is not enough: bench 2026-11-14, a
|
|
3031
|
+
fresh Express build with only `"test"` in package.json passed 2/2 on 1.8.1 and 0/2 with tests-first)."""
|
|
3032
|
+
if self._has_tests is None:
|
|
3033
|
+
found = False
|
|
3034
|
+
try:
|
|
3035
|
+
if not found:
|
|
3036
|
+
n = 0
|
|
3037
|
+
for p in self.root.rglob("*"):
|
|
3038
|
+
n += 1
|
|
3039
|
+
if n > 4000:
|
|
3040
|
+
break
|
|
3041
|
+
if any(part in ("node_modules", ".git", ".venv", "venv", "__pycache__") for part in p.parts):
|
|
3042
|
+
continue
|
|
3043
|
+
nm = p.name.lower()
|
|
3044
|
+
if p.is_file() and (re.match(r"test_.*\.py$|.*_test\.(py|go)$|.*\.(test|spec)\.[jt]sx?$", nm)
|
|
3045
|
+
or nm == "conftest.py"):
|
|
3046
|
+
found = True
|
|
3047
|
+
break
|
|
3048
|
+
except (OSError, ValueError):
|
|
3049
|
+
found = False
|
|
3050
|
+
self._has_tests = found
|
|
3051
|
+
return self._has_tests
|
|
3052
|
+
|
|
3053
|
+
def _note_step_diff(self, edits_before: int) -> None:
|
|
3054
|
+
"""Steps that change no file while the last check is red: three in a row is a stuck loop."""
|
|
3055
|
+
red = bool(self._checks) and self._checks[-1][2] != 0
|
|
3056
|
+
if len(self._real_edits()) > edits_before or not red:
|
|
3057
|
+
self._nodiff_red = 0
|
|
3058
|
+
return
|
|
3059
|
+
self._nodiff_red += 1
|
|
3060
|
+
if self._nodiff_red >= 3:
|
|
3061
|
+
self._signal = self._signal or "stuck_loop"
|
|
3062
|
+
self._nodiff_red = 0
|
|
3063
|
+
|
|
2781
3064
|
def _infer_edit_path(self, args: Dict[str, Any]) -> Optional[str]:
|
|
2782
3065
|
"""edit_file / multi_edit without `path` (bench 2026-11-09: a whole step lost to "Missing required
|
|
2783
3066
|
parameter `path`"): when exactly ONE file this session read or wrote contains every old_string, it is
|
|
@@ -2926,7 +3209,9 @@ class Agent:
|
|
|
2926
3209
|
"owns it: do not edit it; mention it in your report.")
|
|
2927
3210
|
self.ui.tool_result(msg, is_error=True)
|
|
2928
3211
|
return "Error: " + msg, None
|
|
2929
|
-
if self.permissions.mode == "plan" and req.category in PLAN_BLOCKED
|
|
3212
|
+
if (self.permissions.mode == "plan" and req.category in PLAN_BLOCKED
|
|
3213
|
+
and not (req.category == "Bash" and name == "bash"
|
|
3214
|
+
and is_read_only_command(req.command or ""))):
|
|
2930
3215
|
msg = prompts.PLAN_MODE_BLOCKED.format(tool=name)
|
|
2931
3216
|
self.ui.tool_result("blocked: plan mode is on (Shift+Tab to change mode)", is_error=True)
|
|
2932
3217
|
return "Error: " + msg, None
|
|
@@ -401,6 +401,8 @@ class Client:
|
|
|
401
401
|
# 1.8.0: model seconds since the task last made progress (X-Euron-Stall-Sec, the gateway's rescue trigger),
|
|
402
402
|
# and what the gateway said about the last answer (x-euron-tier, x-euron-rescue, x-euron-rescue-left)
|
|
403
403
|
self.stall_sec: Optional[int] = None
|
|
404
|
+
# 1.8.1: a model-shaped failure of the previous step the messages do not show (X-Euron-Signal)
|
|
405
|
+
self.signal: Optional[str] = None
|
|
404
406
|
self.last_tier: Optional[str] = None
|
|
405
407
|
self.last_rescue: Optional[str] = None
|
|
406
408
|
self.last_rescue_left: Optional[int] = None
|
|
@@ -491,6 +493,8 @@ class Client:
|
|
|
491
493
|
h["X-Euron-Mode"] = str(self.mode)
|
|
492
494
|
if isinstance(self.stall_sec, int) and 0 <= self.stall_sec < 1_000_000:
|
|
493
495
|
h["X-Euron-Stall-Sec"] = str(self.stall_sec)
|
|
496
|
+
if self.signal in ("test_failure", "compilation_failure", "stuck_loop"):
|
|
497
|
+
h["X-Euron-Signal"] = str(self.signal)
|
|
494
498
|
return h
|
|
495
499
|
|
|
496
500
|
def _request(self, method: str, path: str, *, auth: bool = True, **kw: Any) -> httpx.Response:
|
|
@@ -231,6 +231,51 @@ def is_destructive(command: str) -> bool:
|
|
|
231
231
|
return any(rx.search(command) for rx in DESTRUCTIVE)
|
|
232
232
|
|
|
233
233
|
|
|
234
|
+
#: commands that only look (plan mode may run them; 1.8.2: "git fetch, then git show origin/x:plan.md" in plan mode
|
|
235
|
+
#: was refused as Bash, and the agent spent 24 steps guessing the file instead)
|
|
236
|
+
_READ_ONLY_HEADS = {
|
|
237
|
+
"ls", "dir", "pwd", "cat", "type", "head", "tail", "wc", "grep", "rg", "findstr", "tree", "stat", "file", "du",
|
|
238
|
+
"which", "where", "whoami", "echo", "get-childitem", "get-content", "gci", "gc", "select-string", "sls",
|
|
239
|
+
"get-location", "test-path", "resolve-path", "get-command",
|
|
240
|
+
}
|
|
241
|
+
_READ_ONLY_GIT = {"status", "log", "show", "diff", "fetch", "branch", "blame", "ls-files", "ls-tree", "rev-parse",
|
|
242
|
+
"remote", "describe", "shortlog", "grep", "tag", "cat-file"}
|
|
243
|
+
_VERSION_FLAGS = {"--version", "-v", "-V", "version"}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def is_read_only_command(command: str) -> bool:
|
|
247
|
+
"""True when every part of the command only reads: listings, file views, searches, git history, versions.
|
|
248
|
+
Redirects, substitutions and destructive commands never are."""
|
|
249
|
+
c = (command or "").strip()
|
|
250
|
+
if not c or _has_dangerous_shell_syntax(c) or is_destructive(c):
|
|
251
|
+
return False
|
|
252
|
+
for seg in _segments(c):
|
|
253
|
+
toks = _tokens(seg)
|
|
254
|
+
if not toks:
|
|
255
|
+
return False
|
|
256
|
+
head = os.path.basename(toks[0]).lower()
|
|
257
|
+
head = head[:-4] if head.endswith(".exe") else head
|
|
258
|
+
if head == "cd" and len(toks) <= 2:
|
|
259
|
+
continue
|
|
260
|
+
if head == "git":
|
|
261
|
+
rest = [t for t in toks[1:] if not t.startswith("-")]
|
|
262
|
+
if not rest or rest[0] not in _READ_ONLY_GIT:
|
|
263
|
+
return False
|
|
264
|
+
if rest[0] in ("branch", "tag", "remote") and len(rest) > 1 and rest[1] not in ("-v", "show", "list"):
|
|
265
|
+
return False # `git branch new`, `git tag v1`, `git remote add` change things
|
|
266
|
+
continue
|
|
267
|
+
if head == "find" and not any(t in ("-delete", "-exec", "-execdir", "-ok", "-fprint") for t in toks):
|
|
268
|
+
continue
|
|
269
|
+
if head in _READ_ONLY_HEADS:
|
|
270
|
+
continue
|
|
271
|
+
if len(toks) == 2 and toks[1] in _VERSION_FLAGS:
|
|
272
|
+
continue # `node -v`, `python --version`
|
|
273
|
+
if head in ("pip", "pip3", "npm", "pnpm", "yarn") and len(toks) >= 2 and toks[1] in ("list", "ls", "show", "view", "outdated", "freeze"):
|
|
274
|
+
continue
|
|
275
|
+
return False
|
|
276
|
+
return True
|
|
277
|
+
|
|
278
|
+
|
|
234
279
|
def _expand(token: str) -> str:
|
|
235
280
|
t = token.strip().strip('"').strip("'")
|
|
236
281
|
t = re.sub(r"(?i)\$env:USERPROFILE", os.path.expanduser("~").replace("\\", "/"), t)
|
|
@@ -184,6 +184,37 @@ def is_check_command(command: str) -> bool:
|
|
|
184
184
|
return any(CHECK_RX.search(p) and not NOT_CHECK_RX.match(p) for p in parts)
|
|
185
185
|
|
|
186
186
|
|
|
187
|
+
#: the project's own tests / build / lint / type check (1.8.1: only these, or a command the user named, verify)
|
|
188
|
+
SUITE_RX = re.compile(
|
|
189
|
+
r"\b(pytest|unittest|py_compile|compileall|mypy|pyright|ruff|flake8|pylint|tsc|eslint|jest|vitest|mocha|tox|nox|"
|
|
190
|
+
r"go (test|build|vet)|cargo (test|build|check|clippy)|mvn|gradle|gradlew|dotnet (test|build)|msbuild(\.exe)?|"
|
|
191
|
+
r"rspec|phpunit|make)\b"
|
|
192
|
+
r"|\bnpm (run )?(test|build|lint|typecheck|check)\b|\b(pnpm|yarn|bun) (run )?(test|build|lint|typecheck|check)\b"
|
|
193
|
+
r"|\bnext (build|lint)\b|\bvite build\b|\bnode --check\b|\bpython3? -m (pytest|unittest|mypy|ruff|flake8|py_compile|compileall)\b",
|
|
194
|
+
re.I)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def is_suite_command(segment: str) -> bool:
|
|
198
|
+
s = (segment or "").strip()
|
|
199
|
+
return bool(s) and bool(SUITE_RX.search(s)) and not NOT_CHECK_RX.match(s)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
_FAILED_ID_RX = re.compile(r"(?m)^(?:FAILED|ERROR)\s+(\S+)|^\s*(?:\u2715|\u00d7|\u25cf)\s+(.+?)\s*$|^--- FAIL: (\S+)")
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def failure_signature(content: str) -> str:
|
|
206
|
+
"""What failed, independent of timings and addresses: the failing test ids, else the last error line."""
|
|
207
|
+
t = content or ""
|
|
208
|
+
ids = sorted({next(g for g in m.groups() if g) for m in _FAILED_ID_RX.finditer(t)})
|
|
209
|
+
if ids:
|
|
210
|
+
sig = "|".join(i.split(" - ")[0].strip() for i in ids[:20])
|
|
211
|
+
else:
|
|
212
|
+
lines = [ln.strip() for ln in t.splitlines() if re.search(r"(?i)error|failed|exception|assert", ln)]
|
|
213
|
+
sig = lines[-1] if lines else (t.strip().splitlines() or [""])[-1]
|
|
214
|
+
sig = re.sub(r"0x[0-9a-f]+|\d+(\.\d+)?s\b|\b\d+\b", "#", sig)
|
|
215
|
+
return sig[:300]
|
|
216
|
+
|
|
217
|
+
|
|
187
218
|
def detect_check_command(files: List[str], package_scripts: Dict[str, str], has_pytest_tests: bool,
|
|
188
219
|
python_cmd: str = "python") -> Optional[str]:
|
|
189
220
|
"""The command that proves a project builds: the build script and the tests when they exist."""
|