fix: v0.10.1 usage ping uses tab presence; CI-safe test
build-deb / Deploy to CT 126 (push) Successful in 12s
build-deb / Lint, test, package (push) Successful in 3m7s
build-deb / Notify on failure (push) Skipped

The usage ping now treats "away" like the needs-you notifier: no DevDesk
tab in view for ~2 minutes. The test sets a presence marker instead of
attaching a tmux client, which never attached in CI. 0.10.0 was never
published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHRLCCdXYm41Qx5kNhehaP
This commit is contained in:
2026-10-12 01:30:18 -04:00
co-authored by Claude Opus 5.5
parent a2edec966a
commit 3a0b099f02
4 changed files with 19 additions and 10 deletions
+11 -1
View File
@@ -1,3 +1,13 @@
devdesk (0.10.1) bookworm; urgency=medium
* Everything in 0.10.0, which was never published: its CI test for the
usage ping depended on attaching a tmux client.
* The usage ping counts you as away the same way "Claude needs you" does:
no DevDesk tab in view for ~2 minutes. A forgotten background tab no
longer silences it.
-- Jared Vititoe <jjvititoe1@gmail.com> Mon, 12 Oct 2026 01:45:00 -0400
devdesk (0.10.0) bookworm; urgency=medium
* Matrix "Claude needs you" is quieter and says what is asked (#50):
@@ -13,7 +23,7 @@ devdesk (0.10.0) bookworm; urgency=medium
worktree if it is clean, and the branch if it is merged.
* Plan meters show when each window resets. If the pace so far would use
a window up before then, they warn instead. Matrix gets one message per
5-hour window past DEVDESK_USAGE_WARN (90%) when you're away (#45).
5-hour window past DEVDESK_USAGE_WARN (90%) when no tab is in view (#45).
* Repo panel lists the changed files; a click opens the diff (#46).
* Copy Claude's last reply as Markdown: a session button and a palette
entry, backed by `--last-reply` (#47).
+1 -1
View File
@@ -54,7 +54,7 @@ DEVDESK_MATRIX_WEBHOOK_FILE=/etc/devdesk/matrix-webhook
DEVDESK_MATRIX_DELAY=60
DEVDESK_MATRIX_QUIET=600
# DEVDESK_USAGE_WARN: post to the same room once per 5-hour window when plan usage
# passes this percent while no browser tab or SSH client is attached (devdesk#45).
# passes this percent while no DevDesk tab is in view (devdesk#45).
DEVDESK_USAGE_WARN=90
# 0 turns off the guard that makes Claude ask before destructive commands
+3 -3
View File
@@ -25,8 +25,8 @@ post() {
# devdesk-notify-matrix --usage PCT RESETS_AT (devdesk#45): started by the status
# line when the 5-hour plan window passes DEVDESK_USAGE_WARN percent. Once per
# window, and only when no client is attached to any session (you're away; a
# browser tab shows its own warning).
# window, and only when no DevDesk tab has been in view for ~2 minutes (presence
# markers; you're away. A tab in view shows its own warning).
if [ "${1:-}" = --usage ]; then
pct=${2:-} resets=${3:-}
[[ $pct =~ ^[0-9]+$ && $resets =~ ^[0-9]+$ ]] || exit 0
@@ -36,7 +36,7 @@ if [ "${1:-}" = --usage ]; then
[ "$(cat "$marker" 2>/dev/null)" != "$resets" ] || exit 0
printf '%s\n' "$resets" >"$marker"
[ -r "$DEVDESK_MATRIX_WEBHOOK_FILE" ] || exit 0
[ -z "$(dd_tmux list-clients -F x 2>/dev/null)" ] || exit 0
[ -z "$(find "$DEVDESK_PRESENCE_DIR" -type f 2>/dev/null | head -n 1)" ] || exit 0
at=$(date -d "@$resets" '+%H:%M %Z')
post "$(jq -cMn --arg p "$pct" --arg at "$at" --arg h "$(hostname)" \
'{kind: "usage", host: $h, text: "Claude plan usage is at \($p)% of the 5-hour window; it resets at \($at)."}')"
+4 -5
View File
@@ -1173,12 +1173,11 @@ JSONL
sleep 0.5
[ "$(posts)" -eq 1 ]
[[ "$(jq -r .text "$TMP/posts")" == *"91% of the 5-hour window"* ]]
# next window, but a client is attached: no post, and that window is done
tmux -S "$DEVDESK_SOCKET" new-session -d -s watcher 'sleep 30'
script -qc "tmux -S '$DEVDESK_SOCKET' attach -t =alpha" /dev/null </dev/null >/dev/null 2>&1 &
for _ in $(seq 1 30); do [ -n "$(tmux -S "$DEVDESK_SOCKET" list-clients -F x)" ] && break; sleep 0.1; done
# next window, but a DevDesk tab is in view: no post, and that window is done
mkdir -p "$DEVDESK_PRESENCE_DIR" && touch "$DEVDESK_PRESENCE_DIR/1"
sl 95 2000018000
sleep 1
for _ in $(seq 1 30); do [ "$(cat "$DEVDESK_STATE_DIR/usage-warned")" = 2000018000 ] && break; sleep 0.1; done
sleep 0.5
[ "$(posts)" -eq 1 ]
[ "$(cat "$DEVDESK_STATE_DIR/usage-warned")" = 2000018000 ]
}