Whole file

hongdangmoo49/Trinity

The author described this change as fix: make rotation/warning thresholds configurable instead of hardcoded. It counts as a record because the checks below fail on the code as it stood at 1cd2216ac and pass on 03640174c, with nothing else changed between the two runs.

Fix saved2026-06-03
Sharing licenceMIT · LICENSE
Change size+6 6

What the code was meant to do, written into the code itself as a save note

fix: make rotation/warning thresholds configurable instead of hardcoded

The change

208208 def ratio(self) -> float:
209209 return self.used / self.total if self.total > 0 else 0.0
210210
211- @property
212- def should_rotate(self) -> bool:
213- return self.ratio >= 0.60
211+ def should_rotate(self, threshold: float = 0.60) -> bool:
212+ """Check if context usage exceeds rotation threshold."""
213+ return self.ratio >= threshold
214214
215215 @property
216216 def remaining(self) -> int:
278278 last_activity: float = 0.0
279279 status: str = "unknown" # "idle", "working", "error", "unknown"
280280
281- @property
282- def context_warning(self) -> bool:
283- return self.context_ratio >= 0.60
281+ def context_warning(self, threshold: float = 0.60) -> bool:
282+ """Check if context usage exceeds warning threshold."""
283+ return self.context_ratio >= threshold
284284

The check that tells the two apart

failpass·tests/test_models.py::TestAgentHealth::test_context_warning
failpass·tests/test_models.py::TestAgentHealth::test_healthy_agent
failpass·tests/test_models.py::TestContextUsage::test_above_threshold
failpass·tests/test_models.py::TestContextUsage::test_at_threshold
failpass·tests/test_models.py::TestContextUsage::test_below_threshold
failpass·tests/test_models.py::TestContextUsage::test_zero_usage

Check file tests/test_models.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it1cd2216ace692f413052038c275491bcfb108fd7
Broken version dated2026-06-03
Moduletrinity.models
Units changedAgentHealth, ContextUsage
Fingerprintef8a1cf9f533e994
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in hongdangmoo49/Trinity