Skip to content

https://github.com/GautamTalksDev/keyring/pull/new/fix/agent-registration-honesty - #6

Merged
GautamTalksDev merged 3 commits into
mainfrom
fix/agent-registration-honesty
Aug 30, 2026
Merged

https://github.com/GautamTalksDev/keyring/pull/new/fix/agent-registration-honesty#6
GautamTalksDev merged 3 commits into
mainfrom
fix/agent-registration-honesty

Conversation

@GautamTalksDev

Copy link
Copy Markdown
Owner

Running the live TrueForge path surfaced four defects, all fixed here.

  • register:agent printed "Done" after a 422 and exited 0. It now prints response
    bodies on non-2xx, verifies the agent via GET /api/v1/agents, and exits non-zero.
  • Provider manifests used camelCase where TrueForge expects snake_case
    (base_url, auth.api_key, models[].model_id), so no provider ever registered and
    the agent 422'd with "provider not configured". The TrueForge driver now works
    end to end: 15 grants, 4 clusters, 1 unknown, 7 cards.
  • The GitHub connector treated HTTP 201 from add-collaborator as an existing grant.
    201 creates an invitation; access doesn't exist until accepted. Pending invitations
    are now distinct and revoked via DELETE /invitations/{id}.
  • docs/EXECUTE.md was missing migration, stub model, KEYRING_ALLOW_STUB, and
    registration steps.

GautamTalksDev and others added 3 commits August 30, 2026 00:54
Abort prior card requests and require responses to match the active scan so old cards and terminal status cannot overwrite a new scan or its headline.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use a monotonic scan-start token to prevent late start responses from replacing the active scan or installing stale SSE subscriptions, keeping queue updates tied to the latest invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the raw TrueForge REST field names, select an available agent model, and make local Docker MCP endpoints reachable. Add streaming support and reconciliation handling to keep the stub harness compatible with TrueForge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Harden TrueForge registration and prevent stale scan UI updates

🐞 Bug fix 🧪 Tests ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Report and verify TrueForge registration failures with compatible manifests and reachable MCP
 URLs.
• Prevent superseded scans and card refreshes from overwriting the active UI session.
• Add streaming stub-model compatibility and regression tests for overlapping scans.
Diagram

graph TD
  UI["Scan UI"] -->|"starts scan"| Hook["Session Hook"] -->|"requests"| API["Keyring API"] -->|"publishes"| SSE["Scan Stream"]
  SSE -->|"current events"| Hook
  CLI["Registration CLI"] -->|"upserts"| TF["TrueForge API"] -->|"runs"| Agent["Keyring Agent"] -->|"calls MCP"| API
  TF -->|"streams completions"| Stub["Stub Model"]
Loading
High-Level Assessment

The layered approach is appropriate: request abortion reduces obsolete work, scan IDs protect reducer state, and monotonic start tokens prevent late starts from owning subscriptions. Cancellation-only or identity-check-only approaches were considered but each leaves a separate race window. Explicit registration verification and non-zero failure status are also preferable to trusting mutation responses.

Files changed (5) +426 / -79

Enhancement (1) +70 / -6
stub-model-server.tsSupport streamed TrueForge stub completions +70/-6

Support streamed TrueForge stub completions

• Adds OpenAI-compatible server-sent event chunks for streamed chat completion requests, including tool calls and terminal markers. Reconciliation detection is narrowed to structured output so the fixture workflow advances correctly.

scripts/stub-model-server.ts

Bug fix (3) +239 / -72
client.tsAllow card fetches to be cancelled +5/-2

Allow card fetches to be cancelled

• Adds an optional AbortSignal to card retrieval and forwards it to the shared request helper. This lets scan-session code terminate obsolete refreshes when another scan takes ownership.

apps/web/src/api/client.ts

useScanSession.tsCoordinate scan ownership and reject stale results +99/-16

Coordinate scan ownership and reject stale results

• Introduces a monotonic scan-start coordinator that invalidates superseded starts and cleans up prior subscriptions. Card refreshes are aborted and tagged by scan ID, while the reducer ignores responses that do not belong to the active scan.

apps/web/src/hooks/useScanSession.ts

register-keyring-agent.tsMake TrueForge registration verifiable and failure-aware +135/-54

Make TrueForge registration verifiable and failure-aware

• Uses TrueForge-compatible provider fields, selects an available model, adjusts local Docker MCP addresses, and supports stub operation without an unavailable skill sandbox. Registration now prints failed response bodies, handles response variants, verifies the agent through the list endpoint, aggregates failures, and exits non-zero instead of reporting false success.

scripts/register-keyring-agent.ts

Tests (1) +117 / -1
useScanSession.test.tsCover stale refresh and superseded start races +117/-1

Cover stale refresh and superseded start races

• Adds reducer coverage proving old scan card responses cannot replace current cards or terminal state. Adds coordinator coverage ensuring only the latest scan start retains its SSE subscription and queue ownership.

apps/web/src/hooks/useScanSession.test.ts

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@GautamTalksDev
GautamTalksDev merged commit 95e8f3f into main Aug 30, 2026
1 check passed
@GautamTalksDev
GautamTalksDev deleted the fix/agent-registration-honesty branch August 30, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant