https://github.com/agentrhq/authsome/issues/220 check the issue and fix it.
Private research annotation
Sign in to add a private research label or note.
- User
https://github.com/agentrhq/authsome/issues/220 check the issue and fix it.
Assistant
Let me fetch the GitHub issue first.
Assistant
Now let me explore the relevant code to understand the current implementation.
Assistant
Now let me look at the server dependencies, health route, and where
create_cryptois called from.Assistant
Let me check for the
initcommand and look at the existing tests for crypto.Assistant
Let me check if there's an init command anywhere and look at the test for doctor:
Assistant
Now I have a full picture. Let me look at a few more things:
Assistant
Now I have a clear picture. Let me implement the changes:
Plan:
- Add
EnvVarCrypto+backend_nametovault/crypto.py, updatecreate_cryptowith env→keyring→filesystem precedence - Change default mode to
"auto"in config and vault - Fix the dangling
exceptbug inhealth.pyand updatewhoamito show effective backend - Add
initcommand to CLI - Add tests
- Add
Assistant
Now update the
create_cryptofactory to implement the precedence logic:Assistant
Now update the default mode in config and vault:
Assistant
Let me look at the full
local.pyand find the library version:Assistant
Now let me continue with the remaining changes. First, let me update
server/dependencies.pyand fixhealth.py, then updatestore/local.pyandconfig.py:Assistant
Now fix
health.py— remove the danglingexceptand updatewhoamito show the effective backend:Assistant
Now update
whoamito show the effective backend:Assistant
Now fix
store/local.py— remove version file, check config file instead, and updateconfig.pyto derivespec_versionfrom the library major version:Assistant
Now update
config.pyto derivespec_versionfrom the library's major version:Assistant
Also update the health check to derive the expected spec_version the same way:
Assistant
Now add the
initcommand to the CLI:Assistant
Now add tests for the new functionality:
Assistant
Now let's run the tests to verify everything works:
Assistant
All 32 crypto tests pass. Now run the full test suite:
Assistant
One test failure — let me check it:
Assistant
Update the test to match the new defaults:
Assistant
All 245 tests pass. Let me also run lint and type checks:
Assistant
All checks pass. Here's a summary of what was implemented:
vault/crypto.py- Added
backend_nameabstract property toVaultCryptoso callers can always introspect the effective backend - Added
EnvVarCrypto— reads a base64-encoded 32-byte key fromAUTHSOME_MASTER_KEY - Updated
create_cryptofactory: env var always wins regardless of configured mode;"auto"mode probes for an existing keyring key then falls back to local file (never auto-creates a keyring entry in fallback)
auth/models/config.pyEncryptionConfig.modedefault changed from"local_key"→"auto"
- Added
- User
commit-push-pr /commit-push-pr
Assistant
PR is open: https://github.com/agentrhq/authsome/pull/224
- User
Update AGENTS.md to ensure that work always happens in a branch and never on main branch, second ensure that everytime you touch a function you update the docstring.
Assistant
Now I'll update both files. The no-main rule belongs in both (it's a workflow convention); the docstring rule strengthens what's already in "Update docs alongside code".
Assistant
Now update CONTRIBUTING.md — the "Making changes" table gets the branch rule, and "AI-assisted development" gets both rules:
Assistant
Both files are updated. The changes are:
AGENTS.md— Two new rules added at the top of the "AI agent rules" section (so they're the first things an agent reads):- Never commit directly to main — branch required for every change, no exceptions
- Update docstrings when touching a function — modify a callable, update its docstring; add one in Google-style if missing
CONTRIBUTING.md— Same two rules added in both the human-facing "Making changes" table (as a row) and the "AI-assisted development" section (as the first two bullet points), so they're visible to all contributors regardless of which section they read.- User
Commit and push
Assistant
Committed and pushed to
feat/220-master-key-precedence. The PR at #224 now includes these doc changes as well.