Repository navigation
Hide AI: a usage limit for background requests - #1019
Merged
Merged
Conversation
A usage limit setting (default 90%, or none) and a shared cell of weekly readings let the router skip an agent that is at or past the limit and ask the next agent of the order instead. An agent with no reading is never limited, requests that name their own agent and routers built without the cell are not judged, and every skip is logged with the agent, its usage and the limit.
…agent is past it The runtime keeps the shared usage cell current from the weekly rows and the setting, folds the pause into labels and Memory analysis, and publishes the limit, each agent's week and the past_limit refusal only when they change. Memory's fixed 80% hold and its weekly judgment are removed; the daily cap stays. Worktree names move to a router that is never limited.
…ording without nested parentheses
…te the pause from one cached read, and log each agent's usage when paused Review follow-ups: the headless usage reader also runs while the order is paused or an agent worked in the last 30 minutes, so a pause can lift without a window; the per-tick label switch reads the cached pause instead of rebuilding the order; the cell clones its readings only when they change; an all-past order outranks the label analyzer's older record on the screen; an unreachable degraded arm is gone.
…it, and time an agent's last work apart from the pet's clock
This was referenced Oct 13, 2026
yansfil
added a commit
that referenced
this pull request
Oct 13, 2026
Related: #1019, #1021 ## Summary Account usage now shows five-hour and weekly windows in up to three sidebar chips and a shared popover. Settings > Usage controls shared pins and visibility, with explicit reasons for unsupported agents. Long values wrap while switches stay in one column; the expanded navigation fits the minimum window at default text size. The node keeps credentials private; typed readings drive both the display and background admission decisions.  ## Review - Judge the window labels, localized reason lines and chip density in the screenshots. - Watch `hide-host/src/usage.rs` for credential boundaries and `herdr-core/src/usage.rs` for failure and refresh state. - Two bounded readers poll off the runtime lock; visible reads use a five-minute cadence and shutdown cancels/joins them. - The core publishes changed readings only; an open popover updates its countdown once per minute. ## Evidence - Shared pin/hide browser flow, parser states, backoff, late-event rejection and restart persistence passed. - Isolated Electron: 720x480, maximum text, English light/Korean dark; footer and Settings reason lines fit; the navigation scrolls at maximum text. - Screenshots use an external Claude CLI fixture and signed-out Codex; they capture the renderer, excluding native chrome. - Real Codex five-hour output and Windows/Linux native visuals were not observed locally; five-hour data uses a documented fixture. - `design/hide-ui.lib.pen` and regenerated `design/hide-screens.pen` passed the design contract and export inspection. <details><summary>Settings screenshots</summary>   </details> ## Breaking change Node protocol 30 removes credential-returning calls; core and device helpers must use compatible builds. <details><summary>Verification record</summary> - PRD: `agents/prd/usage-limits/prd.md` (sha256 8cfe5dc081853e73a09563660509648a18a8a68db94e10d9660510b17416c604) - Base 441e46b → head 613e371, verified 2026-10-13T01:12:26.851Z: PASS - Verification report: `agents/runs/usage-limits/verification-report.json` and `agents/runs/usage-limits/verification-report.md`; source fingerprint 6fa101ddf764c36241f59d20d62ec72824c1665f2b9153eae37cabe50973365b - Suites: - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0) - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0) - Fidelity review: 613e371; all 22 requirements covered and current findings closed, including switch alignment and minimum-window navigation. - Code review: 613e371; prior complete review plus navigation spacing, preserved row targets and updated tab-order/keyboard regression coverage. - Security review: 613e371; no blocking findings. Existing redirect account-header handling and concurrent-growth tail bounds remain follow-ups. - Fixes: queued reads after Hide/backoff, invisible pins including delayed events, unreadable responses, narrow switch alignment, and the 23 px minimum-window Settings navigation overflow. - Checks: Rust full suite 4413 passed/96 ignored; web unit 1478 passed/1 skipped; desktop unit 184 passed/4 skipped; Settings browser suite 3 passed; targeted usage browser and Electron geometry flows passed. - Electron geometry covers four switch right edges and first-label-line centers in EN/KO maximum text, including unavailable/refused-fourth-pin rows; navigation fit without scrolling is checked at default text. - Previous CI found navigation overflow and obsolete tab-order expectations; both were reproduced or identified and corrected. An unrelated project-row focus test passed its retry and remains a flaky follow-up. - Earlier credential request fixtures were updated to the current protocol; this report supersedes earlier heads and source-moved verification. - Delivery follows the approved prerequisite rebase; current-main merge-tree was conflict-free before PR creation. - CI: 613e371 passed all 19 applicable checks, including required `verify`; 2 planned skips. [Run](https://github.com/modakbul-gongbang/hide/actions/runs/38331172563). - Evidence: 32 registered (12 log, 10 screenshot, 10 file); paths are local to the run directory - agents/runs/usage-limits/usage-e2e.log - agents/runs/usage-limits/web-suite.log - agents/runs/usage-limits/review-fixes-tests.log - agents/runs/usage-limits/pin-reconcile-test.log - agents/runs/usage-limits/host-reproduction.log - agents/runs/usage-limits/design-contract-final.log - agents/runs/usage-limits/late-pin-test.log - agents/runs/usage-limits/web-switch-tests.log - agents/runs/usage-limits/usage-footer-en-electron.png - agents/runs/usage-limits/usage-footer-en-electron.json - agents/runs/usage-limits/usage-footer-ko-electron.png - agents/runs/usage-limits/usage-footer-ko-electron.json - agents/runs/usage-limits/usage-popover-en-electron.png - agents/runs/usage-limits/usage-popover-en-electron.json - agents/runs/usage-limits/usage-popover-ko-electron.png - agents/runs/usage-limits/usage-popover-ko-electron.json - agents/runs/usage-limits/usage-settings-bottom-en-electron.png - agents/runs/usage-limits/usage-settings-bottom-en-electron.json - agents/runs/usage-limits/usage-settings-bottom-ko-electron.png - agents/runs/usage-limits/usage-settings-bottom-ko-electron.json - agents/runs/usage-limits/usage-settings-en-electron.png - agents/runs/usage-limits/usage-settings-en-electron.json - agents/runs/usage-limits/usage-settings-ko-electron.png - agents/runs/usage-limits/usage-settings-ko-electron.json - agents/runs/usage-limits/usage-settings-unsupported-en-electron.png - agents/runs/usage-limits/usage-settings-unsupported-en-electron.json - agents/runs/usage-limits/usage-settings-unsupported-ko-electron.png - agents/runs/usage-limits/usage-settings-unsupported-ko-electron.json - agents/runs/usage-limits/native-usage-renderer.log - agents/runs/usage-limits/settings-nav-repro.log - agents/runs/usage-limits/settings-nav-fixed.log - agents/runs/usage-limits/nav-design-contract.log - Changed paths: 78 (see Files changed) - Delivery: mode pr, branch `gen-prd/usage-limits`, base `main` </details>
yansfil
added a commit
that referenced
this pull request
Oct 13, 2026
Closes #1013 Related: #1019 ## Summary - 재동의가 필요하면 기존 스위치 아래에서 분석·주입이 멈춘 이유를 알립니다. - 실행 카드만 `확인 중`으로 표시하고, 대기 카드는 흐리게 표시하며 이유는 목록 위에서 한 번만 설명합니다. - 총 1,000회 중 확인은 최대 500회이며, 재확인과 promotion 확인이 due일 때 필요한 만큼 분석에서 예약합니다. - 통과한 카드는 바로 다시 쓰며, 예산 재개 시각은 보는 사람의 현지 날짜와 시간으로 표시합니다. | 이전 | 변경 후 | | --- | --- | |  |  | 예산 때문에 멈춘 카드를 실행 중처럼 보이지 않게 하고, 현지 재개 시각을 알려 줍니다. ## Review - **판단해 주세요**: 260px 도구 영역에서 대기 카드의 흐림과 현지 재개 시각 안내가 읽기 편한지 확인해 주세요. - **조심해서 볼 파일**: `hide-memory/src/store.rs` - schema 11, 동시 호출의 원자적 예약과 두 종류의 due 확인. - **조심해서 볼 파일**: `memory_analysis.rs`, `memory_verify.rs` - 초기화·사용량 중단·실패 때 진행 상태 정리. - **조심해서 볼 파일**: `model.rs`, `snapshot.ts` - core 소유 상태·사용 가능 수·재개 시각의 wire 계약. - **비용 검토**: 기존 worker에서 호출당 SQLite 트랜잭션 하나이며, 분석 예약은 최대 500개 일치 행을 셉니다. - **비용 검토**: 후보 스캔 수 자체에 새 상한은 없으며, Project별 기존 10,000개 카드 상한 안에서 source·receipt를 조회합니다. - **비용 검토**: 입력 경로의 추가 작업은 없고, 기존 4+3회 확인의 상태 변경만 알립니다. 새 worker·timer·queue는 없습니다. - **사용량 제한**: 병합된 #1019 위로 rebase했습니다. router의 `past_limit`을 기존 `ai_not_ready`와 Settings 연결로 그립니다. ## Evidence - **확인한 것**: 날짜 초기화+사용량 중단의 stale hold와 promotion 확인 예약 누락을 실패 재현 후 회귀 테스트로 검증했습니다. - **확인한 것**: 꺼진 Project의 usable_cards=0, 한 번의 안내, 실행 카드만 표시, 서울·LA의 서로 다른 날짜를 검증했습니다. - **확인한 것**: 격리된 실제 브라우저의 260px 화면에서 4언어·2테마의 안내와 줄바꿈을 확인했습니다. - **로컬 재확인**: 처음 hook 한 건의 timeout과 잘못된 로케일로 실패했습니다. hook 단독·스크립트 325개는 재실행 통과했습니다. - **로컬 검사**: Rust 전체 4,419개, web 1,483개·desktop 184개 unit, typecheck/lint/build, 디자인·구조 검사 통과. - **원격 CI**: 최종 `573bb39d2`의 verify attempt 2와 디자인 계약이 통과했습니다. - **기존 flaky**: 첫 CI는 sidebar #1022로 실패. 같은 SHA의 Linux 2/4는 65 passed·1 flaky이며 기본 retry에 통과했습니다. - **확인하지 못한 것**: 실제 계정의 모델 호출·사용량에 따른 provider 선택과 설치 앱의 Memory native 화면은 확인하지 않았습니다. <details><summary>카드별 진행과 재동의</summary> m17만 확인 중이고 m12는 기다립니다.  쓸 수 있는 카드가 섞여 있어도 대기 이유는 목록 위 한 번만 표시합니다.  재동의는 기존 스위치로만 받습니다.  병합된 #1019의 사용량 제한은 기존 안내와 Settings 연결로 표시합니다.  </details> <details><summary>원격 검증과 기존 flaky</summary> [최종 verify attempt 2](https://github.com/modakbul-gongbang/hide/actions/runs/38326269463/attempts/2)와 [디자인 계약](https://github.com/modakbul-gongbang/hide/actions/runs/38326268769)은 같은 HEAD에서 통과했습니다. verify의 18개 job이 성공했고, plan이 요구하지 않은 package와 단일 Windows web shard의 별도 build job은 skipped입니다. Rust workspace, web·desktop 검사, Linux 4개 web shard, Windows web, macOS·Windows desktop, 3시스템 OS 계약과 remote mailbox를 실행했습니다. [첫 CI 실패](https://github.com/modakbul-gongbang/hide/actions/runs/38326269463/attempts/1)는 기존 [sidebar flaky #1022](https://github.com/modakbul-gongbang/hide/issues/1022)의 포커스 검사입니다. main의 같은 Linux shard에서도 실패 후 기본 retry에 통과한 이슈이며, 현재 SHA의 attempt 2도 동일하게 첫 실패 후 retry PASS했습니다. 이 sidebar flow를 첫 실행부터 확인된 PASS로 보고하지 않습니다. 범위를 유지하여 이 PR에는 sidebar 수정이나 assertion 완화를 포함하지 않았습니다. 전체 로컬 Rust는 `225df081d`에서 4,419 passed·96 ignored였습니다. 최종 delta는 promotion 테스트 fixture의 불필요한 clone을 borrow로 바꾼 것이며 최종 fmt/clippy와 해당 회귀 검사를 다시 통과했습니다. web 1 skipped와 desktop 4 skipped도 기존 suite 결과에 포함되어 있습니다. </details> ## Breaking change - Memory DB를 schema 11로 올린 뒤 이전 바이너리로 돌아가면 `WrongSchema`로 Memory를 읽지 못합니다. - DB는 보존됩니다. 다시 schema 11을 지원하는 버전을 사용해야 하며 DB를 삭제하는 롤백은 하지 않습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: PRD
agents/prd/hide-ai-usage-limit/prd.mdSummary
Usage limitof 80%, 90%, 95% or No limit, one value for all of Hide AI.86% this week, orPast your limitwith the reset time; an agent with no figure shows none and is never held back.Review
hide memory addare not limited (an operator or agent waits on them), as is worktree naming and issue review; no figure means not limited (D-07).herdr-core/src/runtime/usage_limit.rs- snapshot wire fields and the pause state;hide-ai/src/router.rs- the per-request judgment on worker threads;herdr-core/src/runtime/memory_analysis.rs- the deleted 80% hold and weekly judgment.UsageLimits) written only when the limit or a reading changes, and read per request on worker threads; no blocking underMutex<Runtime>.agent_summary()reads a cached pause. With no window attached the usage reader also runs, at most once per agent every 5 minutes, while the order is paused or an agent worked in the last 30 minutes; none on a quiet machine.Evidence
hide-ailane 103 unit and 43 integration tests;herdr-core2107 tests including 11 runtime tests for the limit (event, figures, refusal, pause, resume on raise and on a new week, logs, unchanged read publishes nothing); clippy--workspace -D warnings; web typecheck, lint and 1473 unit tests; a new e2e spec (3 tests) on an isolated hided and Herdr with a scripted usage shim, never the operator's quota.rest, all 3 with an identicalbackground_ai; one limit change: 3 frames. Compared by construction and unit test, not against a main build.check-design-contractnot run (no design part touched); the first Memory pass before the first usage read (about one second after launch) asks Runs on at any usage.More captures
All twelve state captures (runs, fallback, paused; Settings and Memory; light and dark) and a Korean 560 px capture were taken from the same spec and are listed in the Verification record.
Verification record
agents/prd/hide-ai-usage-limit/prd.md(sha256 08f6a9baf3e39e76f3bb35964a661c0c6f757a4ff365b3d6d17b03635fe9f1b4)agents/runs/hide-ai-usage-limit/verification-report.jsonandagents/runs/hide-ai-usage-limit/verification-report.md; source fingerprint 5f0f161e383c9c722c4a9b187ff995b52c74297be921cef6434053d799858644bash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)model_not_found, so Sonnet reviewed):usage_limitdrops the whole settings choice, startup ordering before settings load, one log line per past-limit agent per request.read_memory_reads_usage, arefresh_pettest for the new clock.matchscrutinee inhandle.rs, hungCore::create) was fixed before any review.spec/hide-ai-usage-limit, basemain