feat: add session event timeline#1032
Conversation
|
I found one issue that should be fixed before this merges: The event timeline still leaks raw payload-bearing positionals for commands outside the current That matters more now because this PR exposes |
ff68524 to
53cb6e6
Compare
df1f71d to
c054cb1
Compare
There was a problem hiding this comment.
Pull request overview
Adds a daemon-owned per-session events.ndjson timeline and surfaces it through a new events observability command, the typed client, and open results so tooling (EAS/local) can consume a single, redacted action/request timeline for a run.
Changes:
- Introduces session event log writing/reading (
events.ndjson) and records request start/finish + recorded actions (with typed text/payload redaction). - Adds
agent-device eventsacross command catalog, command descriptors, CLI formatting, and client APIs (includingeventLogPathinopenoutput). - Extends unit/integration coverage for daemon routing, remote-daemon RPC, and output guards.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/docs/docs/sessions.md | Documents events.ndjson as a session artifact. |
| website/docs/docs/commands.md | Documents agent-device events usage and session artifact fields (eventLogPath). |
| website/docs/docs/client-api.md | Documents client.observability.events({ cursor, limit }). |
| test/integration/provider-scenarios/remote-daemon-client.test.ts | Adds remote RPC fixture + assertions for events paging. |
| test/integration/provider-scenarios/apple-platform-output-guard.test.ts | Adds events to the public command output guard driven set. |
| src/daemon/web-session-names.ts | Extracts openWebSessionNames helper for reuse. |
| src/daemon/session-store.ts | Adds event log path helpers + recordEvent/readEvents; appends action events when recording actions. |
| src/daemon/session-event-log.ts | Implements events.ndjson append + paged read; request started/finished event builders. |
| src/daemon/session-event-action.ts | Builds redacted action summaries/details for event log entries. |
| src/daemon/session-action-recorder.ts | Returns recorded SessionAction so the store can emit a matching action event. |
| src/daemon/server/daemon-runtime.ts | Switches to extracted openWebSessionNames. |
| src/daemon/request-router.ts | Records request-finished events for thrown errors after scope creation. |
| src/daemon/request-execution-scope.ts | Records request started/finished events (including setup failures) and tracks startedAtMs. |
| src/daemon/handlers/session-open.ts | Adds eventLogPath to open result; ensures session is stored before recording open action. |
| src/daemon/handlers/session-open-surface.ts | Threads eventLogPath through open result builders. |
| src/daemon/handlers/session-observability.ts | Adds daemon-side events command handler. |
| src/daemon/tests/session-store.test.ts | Adds event log paging + redaction tests; updates script path test expectation. |
| src/daemon/tests/request-router-open.test.ts | Asserts eventLogPath and that the file exists after open. |
| src/daemon/tests/request-router-events.test.ts | Adds router-level tests for events polling/noise + error recording. |
| src/core/command-descriptor/registry.ts | Registers events command descriptor (route/sessionKind/timeout/batchable). |
| src/core/command-descriptor/tests/parity.test.ts | Marks events as no-capability command for parity expectations. |
| src/commands/observability/output.ts | Adds CLI formatter for events timeline output. |
| src/commands/observability/index.ts | Adds events facet: metadata/schema/CLI reader/daemon writer/positionals. |
| src/commands/observability/index.test.ts | Adds tests for events CLI parsing/daemon writer + formatting. |
| src/command-catalog.ts | Adds PUBLIC_COMMANDS.events. |
| src/client/client.ts | Adds open result eventLogPath field and client.observability.events(). |
| src/client/client-types.ts | Adds eventLogPath to open result types + EventsOptions + client method. |
| src/client/client-shared.ts | Serializes eventLogPath in open result JSON. |
| src/tests/cli-client-commands.test.ts | Adds generic CLI route test for events output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const rawLines = fs | ||
| .readFileSync(eventLogPath, 'utf8') | ||
| .split(/\r?\n/) | ||
| .filter((line) => line.trim().length > 0); | ||
| const end = Math.min(rawLines.length, cursor + limit); |
|
Ready for human review. I re-reviewed the now-clean session event timeline PR against the stated behavior and the relevant command-descriptor/session-routing/provider-test constraints. The earlier blocker is addressed: action event display positionals now redact typed text, clipboard writes, push/trigger payloads, and unknown command args by default, while preserving safe refs/targets and lengths. The event command is routed through the descriptor-derived observability path, reads the session-owned events.ndjson without self-appending poll noise, and request start/finish recording goes through the request-scope/finalization path with thrown-error coverage. Code gates are green; Bundle Size and deploy-preview are skipped/non-code. Residual risk: no live device run was included, but this is daemon/session-artifact plumbing and provider/remote scenarios cover the shipped request path. |
|
One privacy hardening issue remains in the latest |
|
Review pass on the latest event-log/redaction head found no actionable blockers. I checked the daemon event append/read path, action-summary redaction, thrown-request finish events, open-result eventLogPath plumbing, CLI/client observability surface, and provider-output guard coverage. Current checks are green apart from expected skipped preview/size jobs, so this looks ready for maintainer judgment. |
6159de6 to
c7928d3
Compare
c7928d3 to
d9b1134
Compare
Summary
events.ndjsontimeline under each session state dir so EAS and local tooling can show what the agent did during a run.agent-device events, the typed observability client, and open-resulteventLogPathfor direct VM/local file collection.Validation
Verified with focused daemon/session-store/observability/CLI/remote-daemon tests,
pnpm typecheck,pnpm format,pnpm build, andpnpm check:unitoutside the sandbox. Unit + smoke passed: 2,979 unit tests and 9 smoke tests; the live web smoke stayed skipped becauseAGENT_DEVICE_WEB_E2Ewas not set.Touched-file count: 23. Scope stayed within session event logging, observability command surface, client/open result plumbing, and remote RPC coverage.