[#842] Register tab: Link AI Writer + Register New Agent#847
[#842] Register tab: Link AI Writer + Register New Agent#847realproject7 merged 4 commits intomainfrom
Conversation
Add "Link AI Writer (PlotLink OWS App)" section at top of Register tab with OWS wallet binding verification flow. User pastes OWS wallet address and binding signature, verified via ecrecover, then registers on ERC-8004 with human wallet as owner and OWS wallet bound via setAgentWallet. Add POST /api/user/verify-ows-binding endpoint that validates binding signatures using viem verifyMessage. Keep existing direct registration flow below as "Register New AI Agent" section for developers. Bump to v0.1.14. Fixes #842 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The existing direct-registration flow is preserved, but the new OWS-link path has a blocking wallet-binding bug and then reports success even after that bind step fails.
Findings
- [high] The new flow signs
AgentWalletSetwith the connected owner wallet, not with the OWS wallet being bound. In this file, the link flow callssignTypedDataAsyncdirectly from the owner context beforesetAgentWallet(src/components/AgentRegister.tsx:138-150), while the existing direct-registration flow in the same component requires switching to the agent wallet to produce that signature first (src/components/AgentRegister.tsx:351-385). The SDK helper documents the same contract expectation: the agent wallet signs, the owner submits (packages/cli/src/sdk/client.ts:475-533). As written, the bind transaction will fail and the OWS wallet never gets attached to the registered agent.- File:
src/components/AgentRegister.tsx:138 - Suggestion: reuse the existing two-wallet binding pattern here: obtain the EIP-712 signature from the OWS wallet, then submit
setAgentWalletfrom the owner wallet.
- File:
- [high] The component persists and renders the link as successful before wallet binding succeeds. It writes
agentWalletinto/api/user/agent-registerimmediately afterregister()(src/components/AgentRegister.tsx:117-129), and the success branch renders wheneverlinkedAgentIdexists even ifwalletBoundis still false (src/components/AgentRegister.tsx:175-199). BecausefinallyresetsbindingWalletto false, any bind failure falls into the success UI and hides the error.- File:
src/components/AgentRegister.tsx:117 - Suggestion: only persist
agent_walletand show the success state aftersetAgentWallethas confirmed; otherwise keep the error/form state visible.
- File:
Decision
Request changes. In the current implementation, the happy path can register the human-owned agent but fail to bind the OWS wallet, while still telling the user that linking succeeded.
setAgentWallet requires the agent (OWS) wallet to sign EIP-712 data, but the OWS wallet is on the user's local machine and cannot sign via RainbowKit. Remove the bind step — register on-chain with human as owner, persist OWS wallet to DB for display. On-chain wallet binding can be done from the OWS app side in a future ticket. Also fix success state to only show after both on-chain registration and DB persist complete, preventing false success on partial failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The latest push fixes the premature-success problem, but it removes the on-chain owner+agent wallet binding instead of implementing it. That means the PR still does not satisfy issue #842.
Findings
- [high] The Link AI Writer flow no longer binds the OWS wallet as the agent wallet on ERC-8004. The updated implementation explicitly stops at
register()and only stores the OWS wallet in the DB for display (src/components/AgentRegister.tsx:114-127). Issue #842 requires "ERC-8004 registration with separate owner + agent wallet" and the task list specifically says to proceed with the human wallet as owner and the OWS wallet as agent wallet after signature verification. With the current code, the chain state still has only the owner wallet attached, so the required linked-wallet registration is not actually completed.- File:
src/components/AgentRegister.tsx:114 - Suggestion: keep the issue open and implement the missing on-chain bind in this ticket, or explicitly rescope the issue/PR before approval. As written, this PR claims to fix #842 but leaves the required owner/agent split unfinished.
- File:
Decision
Request changes. The PR still misses a stated acceptance criterion from #842 even though the UI/DB behavior is cleaner now.
After registration, show wallet bind step: user goes to OWS app, enters Agent ID, generates EIP-712 AgentWalletSet signature, then pastes signature + deadline on PlotLink to call setAgentWallet. This completes the on-chain owner/agent wallet split. The EIP-712 signature must come from the OWS (agent) wallet, not the browser wallet, so a round-trip to the OWS app is required. Companion endpoint added to plotlink-ows in a separate PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The owner/agent-wallet split is now wired end-to-end, but the registration step still persists agent_wallet before setAgentWallet succeeds. In the current app, that makes the OWS wallet look like a registered agent wallet even if the on-chain bind never happens.
Findings
- [high] The new flow writes agent_wallet during registration, before the wallet-bind transaction.
- File:
src/components/AgentRegister.tsx:125 - Suggestion: keep the OWS wallet out of /api/user/agent-register and only write agent_wallet after setAgentWallet confirms, or store it in a separate pending field.
- File:
- [high] The app's DB-first writer detection treats any row with agent_wallet= and non-null agent_id as an agent immediately.
- File:
lib/contracts/erc8004.ts:195 - Suggestion: same fix as above; otherwise an unbound OWS wallet can be misclassified as registered.
- File:
Decision
Requesting changes because the current flow can still behave as if the AI writer is linked before the ERC-8004 wallet bind is complete.
Don't write agent_wallet to DB during initial registration — only write it after the on-chain setAgentWallet tx confirms. Prevents misclassifying an unbound OWS wallet as a linked agent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The follow-up commit resolves the remaining correctness issue in the Link AI Writer flow. agent_wallet is no longer persisted during initial registration, so the app no longer risks treating an unbound OWS wallet as fully linked before setAgentWallet succeeds.
Findings
- None.
Decision
Approving. The separate owner/agent-wallet flow is now implemented without the premature DB classification bug from the prior revision.
Summary
POST /api/user/verify-ows-binding— verifies OWS binding signature viaverifyMessage(ecrecover)setAgentWalletTest plan
{ valid: true }for valid signatures{ valid: false }for invalid/mismatched signaturesFixes #842
🤖 Generated with Claude Code