From 8e5182ab6ca5f04a9d95fda0b0e776c8902d556a Mon Sep 17 00:00:00 2001 From: Fimeg Date: Tue, 18 Aug 2026 20:14:16 -0400 Subject: [PATCH] consciousness: teach the overflow gate anthropic's wording The resuscitation path exists for exactly this: her thread passes the model's ceiling, every pass is refused before a tool round runs, and she can never reach `memory compact` herself. It did not fire. `prompt is too long: 1285770 tokens > 1000000 maximum` matches none of the five patterns the gate was written against on 08-13, when she ran on deepseek and the only wording anyone had seen was "maximum context length". So she reported the same failure every three minutes for half an hour while holding the lever she could not reach. Anthropic's body is now pasted into a test beside deepseek's, verbatim, same rule as the comment above it: a matcher tested only on invented strings has never been seen to fire. The second clause catches a token count stated as over a maximum under a different preamble; both halves are required so an "invalid max_tokens" complaint still reads benign. --- src/server/consciousness_engine.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/server/consciousness_engine.rs b/src/server/consciousness_engine.rs index 909ab73..5ceb544 100644 --- a/src/server/consciousness_engine.rs +++ b/src/server/consciousness_engine.rs @@ -1480,6 +1480,16 @@ fn is_context_overflow(err: &str) -> bool { || e.contains("context length exceeded") || e.contains("reduce the length of the messages") || (e.contains("context window") && e.contains("exceed")) + // Anthropic says it differently, and says nothing the four patterns + // above would catch: `prompt is too long: 1285770 tokens > 1000000 + // maximum`. The gate was written on 08-13 against DeepSeek and had + // never seen a second provider's dialect, so the night she moved to + // opus-5 and overflowed, resuscitation did not fire. + || e.contains("prompt is too long") + // Belt for the same shape under a different preamble — a token count + // stated as over a maximum. Both halves are required so that an + // ordinary "invalid max_tokens" complaint does not match. + || (e.contains("tokens") && e.contains("maximum") && e.contains(">")) } fn parse_urgency(raw: &str) -> Urgency { @@ -1565,6 +1575,22 @@ mod tests { assert!(is_context_overflow(real)); } + /// The exact body Anthropic returned at 19:53 and again at 19:58 on + /// 2026-08-18, when the subconscious had grown to 1.28M tokens against + /// opus-5's 1M ceiling. The gate written for DeepSeek did not match a + /// single word of it, so resuscitation never fired and she reported the + /// failure once every three minutes without ever being able to act. + /// Pasted, not paraphrased — same rule as the DeepSeek body above. + #[test] + fn the_anthropic_wording_is_recognised() { + let real = "claude subscription returned 400 Bad Request after 1 \ + attempt(s) on claude-opus-5: {\"type\":\"error\",\"error\":\ + {\"type\":\"invalid_request_error\",\"message\":\"prompt is too \ + long: 1285770 tokens > 1000000 maximum\"},\"request_id\":\ + \"req_011CeB7NkHDtcvDCpkYDrgPn\"}"; + assert!(is_context_overflow(real)); + } + #[test] fn other_provider_wordings_are_recognised() { assert!(is_context_overflow("context_length_exceeded"));