Shreya2005-2005 commited on
Commit
cc5d66e
·
1 Parent(s): ae0abd1

FINAL FIX: indentation fix and hardened scores to [0.1, 0.9]

Browse files
Files changed (3) hide show
  1. openenv.yaml +8 -8
  2. server/app.py +6 -2
  3. src/environment.py +11 -11
openenv.yaml CHANGED
@@ -96,27 +96,27 @@ tasks:
96
  name: "Survive 8 Hours"
97
  description: >
98
  Study for 8 hours (480 minutes) without energy hitting zero.
99
- Score based on remaining energy at end of session.
100
  max_steps: 120
101
- scoring: 0.01 + energy * 0.0098
102
  success_threshold: 0.5
103
 
104
  - id: maximize_productivity
105
  name: "Maximize Productivity"
106
  description: >
107
- Get as many productive minutes (focus > 60) as possible in a 4-hour session.
108
- Score based on focus and energy levels achieved.
109
  max_steps: 60
110
- scoring: 0.01 + focus * 0.0049 + energy * 0.0049
111
  success_threshold: 0.5
112
 
113
  - id: smart_break_taker
114
  name: "Smart Break Taker"
115
  description: >
116
- Only take breaks when energy is actually low (below 40%).
117
- Score based on energy and focus maintained throughout session.
118
  max_steps: 80
119
- scoring: 0.01 + energy * 0.0049 + focus * 0.0049
120
  success_threshold: 0.6
121
 
122
 
 
96
  name: "Survive 8 Hours"
97
  description: >
98
  Study for 8 hours (480 minutes) without energy hitting zero.
99
+ Score based on remaining energy (clamped 0.1 to 0.9).
100
  max_steps: 120
101
+ scoring: 0.1 + (energy / 100) * 0.8
102
  success_threshold: 0.5
103
 
104
  - id: maximize_productivity
105
  name: "Maximize Productivity"
106
  description: >
107
+ Get as many productive minutes (focus > 60) as possible.
108
+ Score based on focus and energy (clamped 0.1 to 0.9).
109
  max_steps: 60
110
+ scoring: 0.1 + (focus / 200) * 0.8 + (energy / 200) * 0.8
111
  success_threshold: 0.5
112
 
113
  - id: smart_break_taker
114
  name: "Smart Break Taker"
115
  description: >
116
+ Only take breaks when energy is low (below 40%).
117
+ Score based on energy and focus (clamped 0.1 to 0.9).
118
  max_steps: 80
119
+ scoring: 0.1 + (energy / 200) * 0.8 + (focus / 200) * 0.8
120
  success_threshold: 0.6
121
 
122
 
server/app.py CHANGED
@@ -86,8 +86,12 @@ def reset(request: ResetRequest = ResetRequest()):
86
 
87
 
88
  def _clamp_score(v: float) -> float:
89
- """Last-resort clamp: force any score into [0.01, 0.99]."""
90
- return max(0.01, min(0.99, float(v)))
 
 
 
 
91
 
92
 
93
  @app.post("/step")
 
86
 
87
 
88
  def _clamp_score(v: float) -> float:
89
+ """Last-resort clamp: force any score into [0.1, 0.9]."""
90
+ try:
91
+ val = float(v)
92
+ return max(0.1, min(0.9, val))
93
+ except:
94
+ return 0.5
95
 
96
 
97
  @app.post("/step")
src/environment.py CHANGED
@@ -54,9 +54,9 @@ class StudyEnvironment:
54
 
55
  @staticmethod
56
  def _strict_score(value: float) -> float:
57
- """Clamp a score strictly into [0.01, 0.99].
58
- The validator rejects 0.0 and 1.0, so we use a wide margin."""
59
- return max(0.01, min(0.99, round(float(value), 4)))
60
 
61
  def __init__(self, task_id: str = "maximize_productivity", max_session_minutes: int = 480):
62
  self.task_id = task_id
@@ -315,14 +315,14 @@ class StudyEnvironment:
315
 
316
  # FINAL SAFETY NET: if anything is still 0.0 or 1.0, fix it
317
  for k in scores:
318
- if scores[k] <= 0.0:
319
- scores[k] = 0.01
320
- if scores[k] >= 1.0:
321
- scores[k] = 0.99
322
- if current_score <= 0.0:
323
- current_score = 0.01
324
- if current_score >= 1.0:
325
- current_score = 0.99
326
 
327
  return {
328
  "task_id": self.task_id,
 
54
 
55
  @staticmethod
56
  def _strict_score(value: float) -> float:
57
+ """Clamp a score strictly into [0.1, 0.9].
58
+ The validator rejects 0.0 and 1.0, so we use a very safe margin."""
59
+ return max(0.1, min(0.9, round(float(value), 4)))
60
 
61
  def __init__(self, task_id: str = "maximize_productivity", max_session_minutes: int = 480):
62
  self.task_id = task_id
 
315
 
316
  # FINAL SAFETY NET: if anything is still 0.0 or 1.0, fix it
317
  for k in scores:
318
+ if scores[k] <= 0.05:
319
+ scores[k] = 0.1
320
+ if scores[k] >= 0.95:
321
+ scores[k] = 0.9
322
+ if current_score <= 0.05:
323
+ current_score = 0.1
324
+ if current_score >= 0.95:
325
+ current_score = 0.9
326
 
327
  return {
328
  "task_id": self.task_id,