chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0545702fe0
commit
a94632ea3d
131 files changed
+1051
-1746
No files matched your search
@@ -1,5 +1,3 @@
|
||||
//! OpenAI Responses API via ChatGPT subscription OAuth (Codex backend).
|
||||
|
||||
use crate::auth::{Auth, Kind};
|
||||
use crate::{
|
||||
ContentBlock, Error, Message, Provider, Request, Result, Role, StopReason, StreamEvent, Usage,
|
||||
@@ -31,7 +29,6 @@ impl Codex {
|
||||
}
|
||||
}
|
||||
|
||||
/// Tool-call ids are stored as `call_id|item_id` so both survive a round trip.
|
||||
fn split_id(id: &str) -> (&str, Option<&str>) {
|
||||
match id.split_once('|') {
|
||||
Some((c, i)) => (c, Some(i)),
|
||||
@@ -65,7 +62,6 @@ pub fn body(req: &Request) -> Value {
|
||||
"type": "message", "role": "assistant", "status": "completed",
|
||||
"content": [{"type": "output_text", "text": text, "annotations": []}]
|
||||
}),
|
||||
// encrypted reasoning item is replayed verbatim (store=false)
|
||||
(
|
||||
Role::Assistant,
|
||||
ContentBlock::Thinking {
|
||||
@@ -106,7 +102,6 @@ pub fn body(req: &Request) -> Value {
|
||||
"text": {"verbosity": "low"},
|
||||
"include": ["reasoning.encrypted_content"],
|
||||
});
|
||||
// Off has no Codex equivalent (see Effort::levels); send the lowest level instead
|
||||
let e = match req.effort {
|
||||
crate::Effort::Off | crate::Effort::Low => "low",
|
||||
e => e.name(),
|
||||
@@ -117,7 +112,6 @@ pub fn body(req: &Request) -> Value {
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Assembler {
|
||||
/// (output_index, block) — finalized from `output_item.done`
|
||||
blocks: Vec<(u64, ContentBlock)>,
|
||||
}
|
||||
|
||||
@@ -253,8 +247,6 @@ impl Assembler {
|
||||
}
|
||||
}
|
||||
|
||||
/// ChatGPT subscription limits from `x-codex-*` headers: primary/secondary windows (used %,
|
||||
/// window length in minutes, reset as unix seconds) and the credit balance.
|
||||
pub fn quota(h: &reqwest::header::HeaderMap) -> Option<crate::Quota> {
|
||||
use crate::hdr;
|
||||
let mut q = crate::Quota::default();
|
||||
@@ -292,13 +284,10 @@ pub fn quota(h: &reqwest::header::HeaderMap) -> Option<crate::Quota> {
|
||||
(!q.windows.is_empty() || q.credits.is_some()).then_some(q)
|
||||
}
|
||||
|
||||
/// The server hides models whose `minimal_client_version` exceeds ours, so claim a high one
|
||||
/// (override: `HX_CODEX_CLIENT_VERSION`). ponytail: we only list ids; the server still gates use.
|
||||
fn client_version() -> String {
|
||||
std::env::var("HX_CODEX_CLIENT_VERSION").unwrap_or_else(|_| "99.0.0".into())
|
||||
}
|
||||
|
||||
/// `GET {base}/models` body (Codex backend) to catalog entries, by the server's priority.
|
||||
pub fn parse_models(v: &Value) -> Vec<crate::models::ModelInfo> {
|
||||
let mut v: Vec<(i64, crate::models::ModelInfo)> = v["models"]
|
||||
.as_array()
|
||||
@@ -506,7 +495,6 @@ mod tests {
|
||||
}
|
||||
);
|
||||
|
||||
// replay the turn plus a tool result
|
||||
let req = Request {
|
||||
model: "gpt-5-codex".into(),
|
||||
system: "sys".into(),
|
||||
|
||||
Reference in new issue
Block a user