Skip to content

granola agent reads event path from payload.path instead of event.resource.path #108

Description

@willwashburn

What

`granola/agent.ts` reads the note's VFS path from the expanded payload instead of the runtime envelope's authoritative `event.resource.path`.

  • Line 23 calls `readNotePath((await event.expand('full')).data)`.
  • `readNotePath` (lines 65-69) reads `payload.path ?? payload.relayfilePath ?? payload.data?.path` — a best-effort guess at the payload's shape.

Evidence

The runtime already populates the authoritative path on every event before any expansion happens: `workforce/packages/runtime/src/to-agent-event.ts:128-129` sets `resource.path` from `env.paths[0]`, and `EventResource` (`workforce/packages/runtime/src/types.ts:108`) exposes it as `event.resource.path`. `to-agent-event.test.ts:55` asserts `ev.resource.path` directly — no expansion required.

Impact

Handlers relying on `payload.path` can receive `undefined` or a stale path whenever the expanded payload doesn't happen to carry a top-level `path`/`relayfilePath`/`data.path` field, since that shape isn't guaranteed by the envelope contract.

Expected

Read the note path from `event.resource.path` directly instead of expanding the payload and guessing its shape.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions