fix runtime exceptions surfaced when the editor opens

Now that the editor split actually opens (T-197), it exposed latent
issues, plus a coincidental Claude-session crash in the same log:

- T-203: the _EditorDragHandle's slider Semantics had value +
  onIncrease/onDecrease but no increased/decreasedValue, so Flutter
  asserted on every semantics flush — add them. And opening the split
  reparented the Claude pane (direct child → Column/Expanded), tearing
  down its SelectableRegion mid selection-update ('selectable not in
  this registrar' / 'inactive element'); a stable GlobalKey on the
  workspace primary makes Flutter move the element instead.
- T-202: rate_limit_event.resetsAt arrives as a unix-epoch number but
  was cast `as String?`, throwing in the stream-json line parser. Accept
  a num (epoch) or an ISO string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 18:49:09 +02:00
co-authored by Claude Opus 4.8
parent 740cc7bb7b
commit 2e323990df
6 changed files with 57 additions and 12 deletions
@@ -597,17 +597,24 @@ class StreamJsonSession {
final info = j['rate_limit_info'];
if (info is Map) {
final status = info['status'] as String?;
final resetsAt = info['resetsAt'] as String?;
// `resetsAt` may arrive as a unix-epoch number (seconds) or an
// ISO string depending on the claude build — accept both.
final resetsRaw = info['resetsAt'];
DateTime? resetsTime;
String? resetsText;
if (resetsRaw is num) {
resetsTime = DateTime.fromMillisecondsSinceEpoch((resetsRaw * 1000).round(), isUtc: true);
} else if (resetsRaw is String) {
resetsTime = DateTime.tryParse(resetsRaw);
resetsText = resetsRaw;
}
if (status != null) {
String label = 'rate limited';
if (resetsAt != null) {
// Show just the time portion if it's an ISO timestamp.
final t = DateTime.tryParse(resetsAt);
if (t != null) {
label = 'rate limited — resets ${t.toLocal().hour.toString().padLeft(2, '0')}:${t.toLocal().minute.toString().padLeft(2, '0')}';
} else {
label = 'rate limited — resets $resetsAt';
}
if (resetsTime != null) {
final t = resetsTime.toLocal();
label = 'rate limited — resets ${t.hour.toString().padLeft(2, '0')}:${t.minute.toString().padLeft(2, '0')}';
} else if (resetsText != null) {
label = 'rate limited — resets $resetsText';
}
return SessionStatus(rateLimitInfo: label);
}