Repository navigation
feat: add Claude quota recommendations and redacted chat exports - #6
Merged
Merged
Conversation
A slow remote-reply claim can miss the 3s confirm window and then own the source, so announcing on the first miss re-fired every relaunch. Record the episode first and publish the wake only if a later cycle still cannot confirm, so a later-owned source stays silent and a dead one still alarms.
The extra pending cycle and this machine's load made the repaired confirm and the stale-claim race miss their original short waits, so give those two assertions the same 300-tick race bound and a bounded repair retry. Co-authored-by: Cursor <[email protected]>
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.
Intent
Set up a PR so that firstmate commits which currently exist only on the TeohCap Air MacBook land on the earljman/firstmate fork, so all four firstmate machines (Mini, TeohCap Air, Pel Dev Crew, Pel Infra Crew) run the same code.
Context: the Air's firstmate checkout (~/Documents/firstmate, branch main, reachable over SSH as host alias macbook-firstmate) carries 8 commits that are on neither the fork nor upstream, on top of fork merge base 910889a. It has since merged the fork's main (88b956b) on top. The 8 commits:
What Changed
Risk Assessment
🚨 High: The new export can persist unredacted session credentials in its published JSONL files, so it should be fixed before merge.
Testing
The exporter, quota selector, trust command, and real process event runner passed targeted live checks in disposable environments. An initial runner-suite attempt stopped because the host lacks
setsid; the complete rerun passed with a temporary workspace-local replacement. CLI output and persisted verdict evidence were captured, the replacement was removed, and no source changes remain.bash tests/fm-chat-export.test.shbash tests/fm-chat-export.test.shbash tests/fm-claude-account-quota.test.shbash tests/fm-claude-trust.test.shPATH="$PWD/.test-bin:$PATH" bash tests/fm-procevent.test.shEvidence: Live exporter and quota CLI output
Source: Live exporter and quota CLI output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-chat-export.py:234- The transcript export can publish credentials unchanged. A tool result containingAuthorization: Basic dXNlcjpwYXNzorCookie: session=abc123passes throughScrubber.text()because neither header matches its patterns; nestedAuthorizationandCookiefields also pass through the key check at bin/fm-chat-export.py:293.content,tool_input, andtool_outputare then written to the source JSONL andall.jsonlat bin/fm-chat-export.py:589-618. Redact these credential headers in both text and structured fields before publication.🔧 Fix applied.
2 errors still open:
bin/fm-chat-export.py:234- The transcript export can publish credentials unchanged. A tool result containingAuthorization: Basic dXNlcjpwYXNzorCookie: session=abc123passes throughScrubber.text()because neither header matches its patterns; nestedAuthorizationandCookiefields also pass through the key check at bin/fm-chat-export.py:293.content,tool_input, andtool_outputare then written to the source JSONL andall.jsonlat bin/fm-chat-export.py:589-618. Redact these credential headers in both text and structured fields before publication.bin/fm-chat-export.py:250- The round 1 credential-header fix left rawX-API-Key:andX-Auth-Token:headers unredacted. A tool result containing either header with a credential absent from scanned.envfiles passes throughScrubber.text()unchanged and is published in the source JSONL andall.jsonlat bin/fm-chat-export.py:594 and bin/fm-chat-export.py:615-620. Extend header redaction to these credential-bearing headers.🔧 Fix applied.
4 issues (2 errors, 2 warnings) still open:
bin/fm-chat-export.py:234- The transcript export can publish credentials unchanged. A tool result containingAuthorization: Basic dXNlcjpwYXNzorCookie: session=abc123passes throughScrubber.text()because neither header matches its patterns; nestedAuthorizationandCookiefields also pass through the key check at bin/fm-chat-export.py:293.content,tool_input, andtool_outputare then written to the source JSONL andall.jsonlat bin/fm-chat-export.py:589-618. Redact these credential headers in both text and structured fields before publication.bin/fm-chat-export.py:250- The round 1 credential-header fix left rawX-API-Key:andX-Auth-Token:headers unredacted. A tool result containing either header with a credential absent from scanned.envfiles passes throughScrubber.text()unchanged and is published in the source JSONL andall.jsonlat bin/fm-chat-export.py:594 and bin/fm-chat-export.py:615-620. Extend header redaction to these credential-bearing headers.bin/fm-claude-account-quota.sh:141- A schema-5 Claude response with numeric five_hour and seven_day windows is marked available even when quotaSemantics.status is unknown or state.status is stale. The verdict at bin/fm-claude-account-quota.sh:195 can then recommend that account with 80% remaining despite the provider saying its quota is unmeasured. Validate those status fields and both percentRemaining values before treating a profile as readable.bin/fm-chat-export.py:525- If a Claude file contains duplicate UUIDs and is later skipped for a corrupt record or cyclic tree, ingest rolls back its turns but still adds its duplicate count to the manifest. Move the duplicate accounting into the successful-file branch so skipped sessions cannot inflate duplicate_uuids or duplicate_uuids_by_session.🔧 Fix applied.
4 issues (2 errors, 2 warnings) still open:
bin/fm-chat-export.py:234- The transcript export can publish credentials unchanged. A tool result containingAuthorization: Basic dXNlcjpwYXNzorCookie: session=abc123passes throughScrubber.text()because neither header matches its patterns; nestedAuthorizationandCookiefields also pass through the key check at bin/fm-chat-export.py:293.content,tool_input, andtool_outputare then written to the source JSONL andall.jsonlat bin/fm-chat-export.py:589-618. Redact these credential headers in both text and structured fields before publication.bin/fm-chat-export.py:250- The round 1 credential-header fix left rawX-API-Key:andX-Auth-Token:headers unredacted. A tool result containing either header with a credential absent from scanned.envfiles passes throughScrubber.text()unchanged and is published in the source JSONL andall.jsonlat bin/fm-chat-export.py:594 and bin/fm-chat-export.py:615-620. Extend header redaction to these credential-bearing headers.bin/fm-chat-export.py:525- If a Claude file contains duplicate UUIDs and is later skipped for a corrupt record or cyclic tree, ingest rolls back its turns but still adds its duplicate count to the manifest. Move the duplicate accounting into the successful-file branch so skipped sessions cannot inflate duplicate_uuids or duplicate_uuids_by_session.bin/fm-chat-export.py:116- A Cursor agent-tools result containing invalid UTF-8 raises UnicodeDecodeError at line 116. The skip handler at bin/fm-chat-export.py:504 does not catch it, so one corrupt artifact aborts the entire export instead of being recorded as a skipped file. Convert decoding failures to a skippable session error at the artifact reader boundary.✅ **Test** - passed
✅ No issues found.
bash tests/fm-chat-export.test.shbash tests/fm-chat-export.test.shbash tests/fm-claude-account-quota.test.shbash tests/fm-claude-trust.test.shPATH="$PWD/.test-bin:$PATH" bash tests/fm-procevent.test.shbash tests/fm-chat-export.test.shbash tests/fm-claude-account-quota.test.shbash tests/fm-claude-trust.test.shbash tests/fm-procevent.test.sh(initial run stopped at a fixture requiring unavailablesetsid)PATH="$PWD/.test-bin:$PATH" bash tests/fm-procevent.test.sh(workspace-localsetsidshim; passed)Manual disposable-home CLI export and quota checks recorded inlive-cli-export-quota.json✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Air commit reconciliation
Landed unchanged in effect (cherry-picked in order, authorship preserved):
operational-home-layoutskill and adding theconfig/claude-account-profilesline there; both config sections kept in docs/configuration.md)Adapted:
Dropped:
Pipeline review also fixed credential-header redaction in the transcript export (Authorization, Cookie, X-API-Key, X-Auth-Token and similar) and made the quota script refuse to recommend an account whose quota is unmeasured. Two low-severity review warnings were left unfixed: skipped sessions can inflate duplicate-UUID counts in the export manifest, and one invalid-UTF-8 Cursor artifact aborts the whole export instead of being skipped.
Known failures not caused by this PR
tests/fm-calm-pi-extension.test.shfails withgrep disappeared from /export calm.html HTML while calm mode was on. CI installs the newest@earendil-works/pi-coding-agent, now 1.1.0. This PR touches no Pi or Calm code. Evidence it is pre-existing: re-running the CI run for main at 88b956b (run 36690637566, attempt 2) installed Pi 1.1.0 and failed the identical assertion in the same shard. Main's earlier green runs used Pi 0.99.1. Fixing Pi 1.1 compatibility is out of scope here.the replacement did not finish its own TERM shutdownin the process-event tests), a different failure.tests/fm-procevent.test.sh"could not read the draining holder's identity" fails on macOS becausesetsidis not installed. The test file callssetsidon main too (tests/fm-procevent.test.sh line 4618 at 88b956b) and this PR changes nosetsidline in it, so it is pre-existing and environmental. I did not re-run that test on a clean main.