fix(coding-agent): suppressed credential disable tombstones for active accounts
- Update isActionableDisable in usage-cli.ts to accept active accounts and check identity matches. - Suppress credential disable tombstones when an active account exists for the same provider and identity. - Add test coverage for suppressing tombstones when active accounts share the same identity.
This commit is contained in:
@@ -352,6 +352,35 @@ describe("formatUsageBreakdown", () => {
|
||||
expect(text).not.toContain("rotated@example.test");
|
||||
expect(text).not.toContain("Fireworks");
|
||||
});
|
||||
it("suppresses auto-disabled tombstones when an active account exists with the same identity", () => {
|
||||
const now = Date.now();
|
||||
const activeAccounts: UsageAccountIdentity[] = [
|
||||
{
|
||||
provider: "anthropic",
|
||||
type: "oauth",
|
||||
email: "active@example.test",
|
||||
},
|
||||
];
|
||||
const disabled = [
|
||||
{
|
||||
id: 30,
|
||||
provider: "anthropic",
|
||||
type: "oauth" as const,
|
||||
email: "active@example.test",
|
||||
cause: "oauth refresh failed: Refresh token expired",
|
||||
},
|
||||
{
|
||||
id: 31,
|
||||
provider: "anthropic",
|
||||
type: "oauth" as const,
|
||||
email: "truly-dead@example.test",
|
||||
cause: "oauth refresh failed: Refresh token expired",
|
||||
},
|
||||
];
|
||||
const text = stripVTControlCharacters(formatUsageBreakdown([], activeAccounts, now, undefined, disabled));
|
||||
expect(text).not.toContain("active@example.test — disabled");
|
||||
expect(text).toContain("✗ truly-dead@example.test — disabled");
|
||||
});
|
||||
|
||||
it("renders a tombstone-only provider section even when no active credential remains", () => {
|
||||
const disabled = [
|
||||
|
||||
Reference in New Issue
Block a user