databoysu commited on
Commit
1dfb089
Β·
1 Parent(s): 20ef9ad

TraceFix RL Deployed

Browse files
README.md CHANGED
@@ -2,7 +2,7 @@
2
  title: TraceFix-RL
3
  emoji: πŸ§‘β€πŸ’»
4
  colorFrom: blue
5
- colorTo: cyan
6
  sdk: docker
7
  pinned: false
8
  app_port: 7860
 
2
  title: TraceFix-RL
3
  emoji: πŸ§‘β€πŸ’»
4
  colorFrom: blue
5
+ colorTo: indigo
6
  sdk: docker
7
  pinned: false
8
  app_port: 7860
__pycache__/models.cpython-312.pyc CHANGED
Binary files a/__pycache__/models.cpython-312.pyc and b/__pycache__/models.cpython-312.pyc differ
 
models.py CHANGED
@@ -5,7 +5,7 @@ from __future__ import annotations
5
  from typing import Any, Dict, List, Literal, Optional
6
 
7
  from openenv.core.env_server.types import Action, Observation
8
- from pydantic import BaseModel, Field, model_validator
9
 
10
 
11
  ActionType = Literal[
@@ -29,10 +29,27 @@ class CodeAction(Action):
29
  ...,
30
  description="One of VIEW_CODE, RUN_TESTS, REPLACE_LINES, UNDO_EDIT, RESET_TO_ORIGINAL, SUBMIT.",
31
  )
32
- start_line: Optional[int] = Field(default=None, ge=1)
33
- end_line: Optional[int] = Field(default=None, ge=1)
34
  new_code_block: Optional[str] = Field(default=None)
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  @model_validator(mode="after")
37
  def validate_replace_fields(self) -> "CodeAction":
38
  if self.action_type == "REPLACE_LINES":
@@ -42,6 +59,15 @@ class CodeAction(Action):
42
  raise ValueError("REPLACE_LINES requires end_line.")
43
  if self.new_code_block is None:
44
  raise ValueError("REPLACE_LINES requires new_code_block.")
 
 
 
 
 
 
 
 
 
45
  return self
46
 
47
 
 
5
  from typing import Any, Dict, List, Literal, Optional
6
 
7
  from openenv.core.env_server.types import Action, Observation
8
+ from pydantic import BaseModel, Field, field_validator, model_validator
9
 
10
 
11
  ActionType = Literal[
 
29
  ...,
30
  description="One of VIEW_CODE, RUN_TESTS, REPLACE_LINES, UNDO_EDIT, RESET_TO_ORIGINAL, SUBMIT.",
31
  )
32
+ start_line: Optional[int] = Field(default=None)
33
+ end_line: Optional[int] = Field(default=None)
34
  new_code_block: Optional[str] = Field(default=None)
35
 
36
+ @field_validator("start_line", "end_line", mode="before")
37
+ @classmethod
38
+ def _coerce_optional_int(cls, value: Any) -> Optional[int]:
39
+ if value is None:
40
+ return None
41
+ if isinstance(value, str):
42
+ raw = value.strip()
43
+ if raw == "":
44
+ return None
45
+ try:
46
+ return int(raw)
47
+ except ValueError:
48
+ return None
49
+ if isinstance(value, int):
50
+ return value
51
+ return None
52
+
53
  @model_validator(mode="after")
54
  def validate_replace_fields(self) -> "CodeAction":
55
  if self.action_type == "REPLACE_LINES":
 
59
  raise ValueError("REPLACE_LINES requires end_line.")
60
  if self.new_code_block is None:
61
  raise ValueError("REPLACE_LINES requires new_code_block.")
62
+ if self.start_line < 1 or self.end_line < 1:
63
+ raise ValueError("REPLACE_LINES requires start_line and end_line >= 1.")
64
+ if self.start_line > self.end_line:
65
+ raise ValueError("REPLACE_LINES requires start_line <= end_line.")
66
+ else:
67
+ # Ignore extra form fields for non-edit actions (web UI often sends defaults).
68
+ self.start_line = None
69
+ self.end_line = None
70
+ self.new_code_block = None
71
  return self
72
 
73
 
pre-val.sh CHANGED
File without changes
server/__pycache__/app.cpython-312.pyc CHANGED
Binary files a/server/__pycache__/app.cpython-312.pyc and b/server/__pycache__/app.cpython-312.pyc differ