Skip to content

Fix component by passing AGENTMAIL_API_KEY using standard Convex recomendations - #6

Open
nicu-chiciuc wants to merge 7 commits into
agentmail-to:mainfrom
samebase:fix-component-configuration
Open

nicu-chiciuc wants to merge 7 commits into
agentmail-to:mainfrom
samebase:fix-component-configuration

Conversation

@nicu-chiciuc

@nicu-chiciuc nicu-chiciuc commented Sep 10, 2026

Copy link
Copy Markdown

Fixes credential access inside the AgentMail component.

Component functions [do not inherit the app’s environment variables](https://docs.convex.dev/components/authoring#environment-variables), so AGENTMAIL_API_KEY and AGENTMAIL_BASE_URL must be declared and explicitly bound.

The component now reads these through the generated typed env export, and the README/example show the required bindings.

The app-side client (in AgentMail) retains process.env, which is supported for [client wrappers running in the app’s environment](https://docs.convex.dev/components/authoring#wrapping-the-component-with-client-code).
Although its current role might be confusing since it's checking env of the parent app which might not be correct.

Adds "prepare": "npm run build" so Git installs include the built package, following npm's Git dependency lifecycle. Verified Scout installs and builds the fork automatically with its pnpm allowBuilds entry.

Verified the package build and authenticated inbox listing through a real Convex development deployment. Two example type errors under Convex 1.45 remain in the unchanged context helper types.

Replaces #5 after renaming the source branch.

Elioz404 pushed a commit to Elioz404/Backpack that referenced this pull request Sep 14, 2026
The three-inbox free tier was the last hard wall: a household got an inbox of
its own, so the fourth family could not have an address. It turns out not to be
a wall — AgentMail delivers sub-addressed mail, which is not in their docs
either way, so it was worth probing rather than assuming.

Households now share one inbox and are told apart by tag: each gets
<inbox>+<householdId>@, and inbound mail routes on the address it was sent to.
That one indexed lookup covers both shapes, since a household from before this
stores the bare inbox address and matches the same way — nothing already live
changed. A guarded second path accepts a tag naming a real household whose
address we have not stored, but only when that household claimed this inbox, so
a guessed id cannot put mail on someone else's board.

Dropped the now-unused by_inbox index rather than leave it costing writes.

Proven in production with two households on one inbox: a notice to the second
household's sub-address produced one correctly typed obligation on its board
and left the first household's seven untouched.

Also recorded that the component defect was independently found four days
earlier in agentmail-to/convex#6, still open and unmerged.
Elioz404 added a commit to Elioz404/Backpack that referenced this pull request Sep 15, 2026
The three-inbox free tier was the last hard wall: a household got an inbox of
its own, so the fourth family could not have an address. It turns out not to be
a wall — AgentMail delivers sub-addressed mail, which is not in their docs
either way, so it was worth probing rather than assuming.

Households now share one inbox and are told apart by tag: each gets
<inbox>+<householdId>@, and inbound mail routes on the address it was sent to.
That one indexed lookup covers both shapes, since a household from before this
stores the bare inbox address and matches the same way — nothing already live
changed. A guarded second path accepts a tag naming a real household whose
address we have not stored, but only when that household claimed this inbox, so
a guessed id cannot put mail on someone else's board.

Dropped the now-unused by_inbox index rather than leave it costing writes.

Proven in production with two households on one inbox: a notice to the second
household's sub-address produced one correctly typed obligation on its board
and left the first household's seven untouched.

Also recorded that the component defect was independently found four days
earlier in agentmail-to/convex#6, still open and unmerged.
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