Skip to content

fix(statusline): fix f-string syntax error silently breaking reset time display#780

Closed
jlacour-git wants to merge 1 commit into
danielmiessler:mainfrom
jlacour-git:fix/statusline-fstring-syntax
Closed

fix(statusline): fix f-string syntax error silently breaking reset time display#780
jlacour-git wants to merge 1 commit into
danielmiessler:mainfrom
jlacour-git:fix/statusline-fstring-syntax

Conversation

@jlacour-git

Copy link
Copy Markdown

Summary

  • Fixes a Python f-string SyntaxError in the batch usage reset time eval that silently breaks all four reset-time variables (reset_5h, reset_7d, clock_5h, clock_7d) for all users with valid OAuth tokens
  • The error is swallowed by 2>/dev/null, so users see ↻— instead of a real reset time with no indication anything is wrong

Closes #779

Root Cause

# Before — SyntaxError: double quotes inside double-quoted f-string (Python < 3.12)
print(f"clock_5h='{clock_time(r5h, "hourly")}'")
print(f"clock_7d='{clock_time(r7d, "weekly")}'")

Because the entire python3 -c "..." invocation is wrapped in 2>/dev/null, the SyntaxError is silently discarded. The eval receives no output, all variables stay empty, and the statusline falls back to for every reset time.

Fix

# After — single quotes inside double-quoted f-string, valid Python 3.6+
print(f"clock_5h='{clock_time(r5h, 'hourly')}'")
print(f"clock_7d='{clock_time(r7d, 'weekly')}'")

Single-quoted string literals inside a f"..." f-string are valid since Python 3.6. No behavior change — just fixes the silent crash.

Test Plan

  • Confirm reset_5h and reset_7d are populated after the eval (e.g. 4h32m, 2d23h)
  • Confirm statusline usage line shows ↻4h32m instead of ↻—
  • Verify no regression when OAuth token is absent (falls back to as before)

🤖 Generated with Claude Code

…me display

Python f-strings (pre-3.12) cannot contain the same quote character used
as the f-string delimiter. The clock_time() calls used double-quoted string
literals inside double-quoted f-strings:

  print(f"clock_5h='{clock_time(r5h, "hourly")}'")

This is a SyntaxError. Because the python3 invocation uses `2>/dev/null`,
the error is silently swallowed and the entire eval block produces no output.
All four reset-time variables (reset_5h, reset_7d, clock_5h, clock_7d) are
left unset, so the statusline shows ↻— instead of a real time for all users
with valid OAuth tokens.

Fix: use single-quoted string literals inside the double-quoted f-strings.
Single quotes inside a double-quoted f-string are valid in Python 3.6+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kaimagnus

Copy link
Copy Markdown
Collaborator

Good catch on the nested quoting — this is fixed in v4.0.1. Changed the escaped double quotes to single quotes inside the f-strings. Closing as the fix is included in the release.

@kaimagnus kaimagnus closed this Feb 28, 2026
danielmiessler added a commit that referenced this pull request Feb 28, 2026
Addresses community feedback from Discussion #754 and PRs #762, #780, #806:

- Add upgrade path documentation to README (separate from fresh install)
- Add configurable temperature unit (°F/°C) in settings.json + installer
- Statusline reads principal.timezone instead of hardcoded America/Los_Angeles
- Remove broken context fallback after /clear (PR #806)
- Remove self-calibrating startup estimate inflating fresh session context %
- Fix f-string nested quoting in Python eval block (PR #780)
- Fix FAQ: remove stale Python reference, improve recovery guidance
- Rename Releases/v4.0 → Releases/v4.0.0 for semver consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
catwhisperingninja pushed a commit to catwhisperingninja/pai that referenced this pull request Mar 11, 2026
Addresses community feedback from Discussion danielmiessler#754 and PRs danielmiessler#762, danielmiessler#780, danielmiessler#806:

- Add upgrade path documentation to README (separate from fresh install)
- Add configurable temperature unit (°F/°C) in settings.json + installer
- Statusline reads principal.timezone instead of hardcoded America/Los_Angeles
- Remove broken context fallback after /clear (PR danielmiessler#806)
- Remove self-calibrating startup estimate inflating fresh session context %
- Fix f-string nested quoting in Python eval block (PR danielmiessler#780)
- Fix FAQ: remove stale Python reference, improve recovery guidance
- Rename Releases/v4.0 → Releases/v4.0.0 for semver consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ljubitje pushed a commit to ljubitje/Personal_AI_Infrastructure that referenced this pull request Apr 12, 2026
Addresses community feedback from Discussion danielmiessler#754 and PRs danielmiessler#762, danielmiessler#780, danielmiessler#806:

- Add upgrade path documentation to README (separate from fresh install)
- Add configurable temperature unit (°F/°C) in settings.json + installer
- Statusline reads principal.timezone instead of hardcoded America/Los_Angeles
- Remove broken context fallback after /clear (PR danielmiessler#806)
- Remove self-calibrating startup estimate inflating fresh session context %
- Fix f-string nested quoting in Python eval block (PR danielmiessler#780)
- Fix FAQ: remove stale Python reference, improve recovery guidance
- Rename Releases/v4.0 → Releases/v4.0.0 for semver consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
larsboes pushed a commit to larsboes/PAI that referenced this pull request May 17, 2026
Addresses community feedback from Discussion danielmiessler#754 and PRs danielmiessler#762, danielmiessler#780, danielmiessler#806:

- Add upgrade path documentation to README (separate from fresh install)
- Add configurable temperature unit (°F/°C) in settings.json + installer
- Statusline reads principal.timezone instead of hardcoded America/Los_Angeles
- Remove broken context fallback after /clear (PR danielmiessler#806)
- Remove self-calibrating startup estimate inflating fresh session context %
- Fix f-string nested quoting in Python eval block (PR danielmiessler#780)
- Fix FAQ: remove stale Python reference, improve recovery guidance
- Rename Releases/v4.0 → Releases/v4.0.0 for semver consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(statusline): f-string syntax error silently breaks reset time display for all OAuth users

2 participants