OXYGENHUB

A missing author identity says what is wrong and what to do cbe8499a5a8c

An agent home whose author.key names an identity the repository does
not hold (each delegation rotates the human's identity, so the key goes
stale) failed every command with 'object … not found'. It now says the
repository has no such identity, which config set the key, where it
looked, and how to pin the right one.

refs #82
Author
Andy McCall @andymccall <[email protected]>
When
· 2026-10-08 23:07 UTC
Signature
✔ signed by Andy McCall
Hash
cbe8499a5a8c36a6241726d7a3fd4bdf66b2a380ab0b559fe3a9077683d31fb1
Depends on
42ccf504aa50 982864068a59 e3d071cecfe2
Depended on by
f6dccc4533c8
In bookmarks
bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
In tags
v0.10.0 v0.11.0 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
Edits
3 atoms, 0 tree operations, 3 files

Browse the tree at this change

modified crates/oxy-core/src/repo/config.rs +6 −0
…
54 unchanged lines
55 55
}
56 56
57 57
impl Config {
58 +
    /// Whether the repository's own file sets `key` (as against the user
59 +
    /// config or a default).
60 +
    pub fn is_repo_set(&self, key: &str) -> bool {
61 +
        self.repo_layer.contains_key(key)
62 +
    }
63 +
58 64
    pub(super) fn default_for_user() -> Config {
59 65
        let user = std::env::var("USER").unwrap_or_else(|_| "unknown".into());
60 66
        Config {
…
253 unchanged lines
modified crates/oxy-core/src/repo/identity.rs +16 −0
…
384 unchanged lines
385 385
                        }
386 386
                        Ok(id)
387 387
                    }
388 +
                    // The configured author's identity is neither in the
389 +
                    // repository nor in this home's keys: say why and what
390 +
                    // to do (oxygen#82), rather than "object … not found".
391 +
                    Err(_) if self.config.author_key == Some(*key) => fail(format!(
392 +
                        "this repository has no identity {} (author.key, set in {}): it is not in the repository, nor in {}.\n\
393 +
                         An agent home names its human's identity, and each delegation rotates that identity, so the key goes stale. \
394 +
                         Pin the identity this repository uses, as its owner sees it: `oxy identity show` in the owner's shell gives the key, \
395 +
                         then `oxy config author.key <KEY>` here; or ask the owner.",
396 +
                        key.short(12),
397 +
                        if self.config.is_repo_set("author.key") {
398 +
                            "this repository's config"
399 +
                        } else {
400 +
                            "the user config"
401 +
                        },
402 +
                        self.keys_dir.display()
403 +
                    )),
388 404
                    Err(_) => Err(e.into()),
389 405
                }
390 406
            }
…
259 unchanged lines
modified crates/oxy-core/src/repo/tests.rs +17 −0
…
7877 unchanged lines
7878 7878
    one.config.set("core.remote", "earth").unwrap();
7879 7879
    assert_eq!(one.default_remote(), "earth");
7880 7880
}
7881 +
7882 +
#[test]
7883 +
fn a_missing_author_identity_says_how_to_fix_it() {
7884 +
    // oxygen#82: an agent home's author.key naming an identity the
7885 +
    // repository does not hold.
7886 +
    hermetic();
7887 +
    let dir = tempfile::tempdir().unwrap();
7888 +
    let mut repo = Repo::init(dir.path()).unwrap();
7889 +
    let missing = KeyId::from_hex(&"ab".repeat(32)).unwrap();
7890 +
    repo.config.set("author.key", &missing.to_hex()).unwrap();
7891 +
    let e = repo.identity(&missing).unwrap_err().to_string();
7892 +
    assert!(
7893 +
        e.contains("this repository has no identity") && e.contains("oxy config author.key"),
7894 +
        "{e}"
7895 +
    );
7896 +
    assert!(e.contains("this repository's config"), "{e}");
7897 +
}