Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,50 @@ export function setupKeyboardHandler(
return false;
}

// OS-level clipboard chords must always bubble so the host (Electron /
// xterm.js Selection / OS) can fulfil copy / paste / cut / select-all.
// Without this, #3390's "unregistered → PTY" rule swallows Cmd+C/V/X/A
// (Mac) and the Linux/Windows clipboard chords, breaking text copy
// from the terminal pane. Regression of #3390.
const onlyMeta =
event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
const ctrlShiftOnly =
event.ctrlKey && event.shiftKey && !event.metaKey && !event.altKey;
const onlyCtrl =
event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
const onlyShift =
event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey;
if (isMac && onlyMeta) {
// Cmd+C copy, Cmd+V paste, Cmd+X cut, Cmd+A select-all
if (
event.code === "KeyC" ||
event.code === "KeyV" ||
event.code === "KeyX" ||
event.code === "KeyA"
) {
return false;
}
}
if (!isMac) {
// Ctrl+Shift+C/V/X/A — Linux/Windows terminal clipboard chords.
if (
ctrlShiftOnly &&
(event.code === "KeyC" ||
event.code === "KeyV" ||
event.code === "KeyX" ||
event.code === "KeyA")
) {
return false;
}
// Ctrl+Insert = copy, Shift+Insert = paste. Deliberately exclude
// Ctrl+Delete (delete-word-forward in shells) and Shift+Delete
// (ambiguous; many terminals treat as readline edit) — those must
// reach the PTY.
if (event.code === "Insert" && (onlyCtrl || onlyShift)) {
return false;
}
}

// Only bubble chords registered as app hotkeys; everything else reaches the PTY.
// Mirrors v2 terminal-runtime.ts:21 (VSCode terminalInstance pattern).
if (resolveHotkeyFromEvent(event) !== null) return false;
Expand Down
11 changes: 11 additions & 0 deletions docs/observability/event-taxonomy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Event Taxonomy

Blueprint refs: P1, P2, P6, P8, P19.

Status: seed. Add events only through typed helpers/proxy; do not scatter vendor SDK calls.

| Event | Journey | When | Required fields | Forbidden fields |
| --- | --- | --- | --- | --- |
| `superset.journey_started` | TBD | User/system intent accepted | `correlation_id`, `surface`, `environment`, `app_version` | raw content, token, email, phone |
| `superset.journey_completed` | TBD | Business success confirmed | `correlation_id`, `result`, `success` | raw content, token, email, phone |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Completion and failure journey events should require the same environment and app_version dimensions as the start event, or the document should explicitly state that the typed proxy auto-enriches them. Otherwise the taxonomy cannot support consistent end-to-end observability slicing (e.g., failure rates by version or environment).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/observability/event-taxonomy.md, line 10:

<comment>Completion and failure journey events should require the same `environment` and `app_version` dimensions as the start event, or the document should explicitly state that the typed proxy auto-enriches them. Otherwise the taxonomy cannot support consistent end-to-end observability slicing (e.g., failure rates by version or environment).</comment>

<file context>
@@ -0,0 +1,11 @@
+| Event | Journey | When | Required fields | Forbidden fields |
+| --- | --- | --- | --- | --- |
+| `superset.journey_started` | TBD | User/system intent accepted | `correlation_id`, `surface`, `environment`, `app_version` | raw content, token, email, phone |
+| `superset.journey_completed` | TBD | Business success confirmed | `correlation_id`, `result`, `success` | raw content, token, email, phone |
+| `superset.journey_failed` | TBD | Bounded failure class known | `correlation_id`, `error_class`, `success` | raw error message as label |
</file context>

| `superset.journey_failed` | TBD | Bounded failure class known | `correlation_id`, `error_class`, `success` | raw error message as label |
25 changes: 25 additions & 0 deletions docs/observability/field-registry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Observability Field Registry

Blueprint source: company-wide `observability-blueprint.md`. This repo adapts the contract; it does not fork the blueprint.

| Field | Type | Headers | Logs | Spans | Metric labels | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `request_id` | generated id | yes | yes | yes | no | One HTTP/IPC/job operation. |
| `trace_id` | W3C trace id | `traceparent` | yes | native | no | Full journey trace. |
| `span_id` | W3C span id | `traceparent` | yes | native | no | Current operation span. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The span_id row maps the field directly to the traceparent header without clarifying that the header's parent-id is the caller's span (parent span) on ingress and the current span only on egress. This can cause implementers to use the wrong span ID for local spans, breaking trace/span correlation.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/observability/field-registry.md, line 9:

<comment>The `span_id` row maps the field directly to the `traceparent` header without clarifying that the header's `parent-id` is the caller's span (parent span) on ingress and the current span only on egress. This can cause implementers to use the wrong span ID for local spans, breaking trace/span correlation.</comment>

<file context>
@@ -0,0 +1,25 @@
+| --- | --- | --- | --- | --- | --- | --- |
+| `request_id` | generated id | yes | yes | yes | no | One HTTP/IPC/job operation. |
+| `trace_id` | W3C trace id | `traceparent` | yes | native | no | Full journey trace. |
+| `span_id` | W3C span id | `traceparent` | yes | native | no | Current operation span. |
+| `correlation_id` | generated id | yes | yes | yes | no | One business action/retry chain. |
+| `actor_id` | hashed/pseudonymous id | yes | yes | yes | no | Never raw email/phone/customer id. |
</file context>
Suggested change
| `span_id` | W3C span id | `traceparent` | yes | native | no | Current operation span. |
| `span_id` | W3C span id | `traceparent` | yes | native | no | Current operation span. Inbound `traceparent.parent-id` is the parent span; the current span ID is generated locally and becomes `parent-id` in outbound `traceparent`. |

| `correlation_id` | generated id | yes | yes | yes | no | One business action/retry chain. |
| `actor_id` | hashed/pseudonymous id | yes | yes | yes | no | Never raw email/phone/customer id. |
| `session_id` | session id | optional | yes | yes | no | Browser/app session. |
| `app_version` | bounded string | yes | yes | yes | yes | Release/git SHA/build id. |
| `environment` | enum | optional | yes | yes | yes | `development`, `staging`, `production`. |
| `surface` | enum | yes | yes | yes | yes | `web`, `api`, `worker`, `job`, `desktop`, `mobile`, `gateway`. |
| `route` | template | no | yes | yes | yes | No raw URLs or query strings. |
| `operation` | bounded string | optional | yes | yes | yes | Business operation name. |
| `result` | enum | optional | yes | yes | yes | `success`, `failure`, `cancelled`, `timeout`, `fallback`. |
| `success` | string enum | optional | yes | yes | yes | Use `"true"`/`"false"` for labels. |
| `error_class` | bounded enum | optional | yes | yes | yes | Never raw error message as a label. |

Rules:
- IDs are fine in logs/traces, not metric labels.
- Raw stable identifiers stay local unless explicitly approved.
- Telemetry helpers must redact tokens, cookies, emails, phones, prompts, raw files, webhook URLs, and URL query secrets.
23 changes: 23 additions & 0 deletions docs/observability/journeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Observability Journeys

## J1 — user sends chat/tool request

Start: TBD.
Success: TBD.
Failure/timeout/cancel: TBD.
Required signals: product event, structured log, metric, trace/span.

## J2 — runtime executes provider call

Start: TBD.
Success: TBD.
Failure/timeout/cancel: TBD.
Required signals: product event, structured log, metric, trace/span.

## J3 — desktop/web session recovers from error

Start: TBD.
Success: TBD.
Failure/timeout/cancel: TBD.
Required signals: product event, structured log, metric, trace/span.

34 changes: 34 additions & 0 deletions docs/observability/query-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Observability Query Reference

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Unrelated observability documentation file added inside a focused desktop clipboard bugfix PR. This couples a docs contract change to a bugfix, increasing review/rollback risk and violating the team's keep-PRs-focused guidance.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/observability/query-reference.md, line 1:

<comment>Unrelated observability documentation file added inside a focused desktop clipboard bugfix PR. This couples a docs contract change to a bugfix, increasing review/rollback risk and violating the team's keep-PRs-focused guidance.</comment>

<file context>
@@ -0,0 +1,34 @@
+# Observability Query Reference
+
+Status: initial repo contract. Fill datasource names when Grafana/OTel/PostHog/Sentry wiring lands.
</file context>


Status: initial repo contract. Fill datasource names when Grafana/OTel/PostHog/Sentry wiring lands.

## Canonical labels

- `environment`: `development`, `staging`, `production`
- `surface`: `web`, `api`, `worker`, `job`, `desktop`, `mobile`, `gateway`
- `success`: `"true"` or `"false"`
- `route`: route templates only
- `operation`: bounded business operation names

## Baseline metrics expected

- `api_requests_total` or repo equivalent
- `http_server_request_duration_seconds`
- `job_runs_total`
- `job_duration_seconds`
- `external_dependency_requests_total`
- `external_dependency_duration_seconds`
- `telemetry_events_accepted_total`
- `telemetry_events_rejected_total`
- `telemetry_events_dropped_total`
- `telemetry_export_failures_total`

## Missing-data taxonomy

Empty dashboard can mean: no traffic, no failures, broken exporter, wrong query function, wrong environment label, not deployed yet, ingestion delay, datasource/query error.

## False query traps

- Do not query raw URLs; use route templates.
- Do not group metrics by generated IDs or user hashes.
- Do not use `rate()` on serverless event gauges; use the documented function for that metric type.
17 changes: 17 additions & 0 deletions docs/observability/system-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# superset Observability System Overview

Blueprint source: company-wide `observability-blueprint.md`. Vendor stack can vary; principle IDs do not.

Repo: `/Users/aytuncyildizli/superset`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Machine-specific absolute local path with username is committed in shared documentation. Replace /Users/aytuncyildizli/superset with a generic representation such as the repo root, a relative path, or the Git URL so the doc is accurate and portable across contributors and environments.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/observability/system-overview.md, line 5:

<comment>Machine-specific absolute local path with username is committed in shared documentation. Replace `/Users/aytuncyildizli/superset` with a generic representation such as the repo root, a relative path, or the Git URL so the doc is accurate and portable across contributors and environments.</comment>

<file context>
@@ -0,0 +1,17 @@
+
+Blueprint source: company-wide `observability-blueprint.md`. Vendor stack can vary; principle IDs do not.
+
+Repo: `/Users/aytuncyildizli/superset`
+Surface: agent/desktop/web app surface
+
</file context>

Surface: agent/desktop/web app surface

## Minimum contract

- Correlation: `request_id`, `trace_id`, `span_id`, `correlation_id`, privacy-safe `actor_id`.
- Signals: structured logs, metrics, traces/manual business spans, product/client events where applicable.
- Privacy: no raw secrets, prompts, files, emails, phone numbers, webhook URLs, cookies, or raw customer ids in telemetry.
- Operations: health and readiness are separate; dashboards/alerts/runbooks live in source control.

## Implementation status

RED until this repo has real helpers/tests/wiring. This directory is the source-control contract seed.
20 changes: 20 additions & 0 deletions ops/runbooks/observability-triage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Runbook: Observability Triage

## First checks

1. Is `/health` live or equivalent process liveness green?
2. Is `/ready` or dependency readiness green?
3. Are metrics/logs/traces present for the expected `environment`?
4. Are recent deploy/version labels visible?
5. Is missing data caused by no traffic, broken exporter, wrong label, or ingestion delay?

## Privacy guard

Do not paste raw logs if they may contain secrets, prompts, files, emails, phone numbers, webhook URLs, cookies, session strings, or raw customer ids. Redact first.

## Escalation

- SEV1: core journey unavailable, data loss, security/privacy incident.
- SEV2: major journey degraded for meaningful user segment.
- SEV3: partial degradation, elevated errors, workaround exists.
- SEV4: low-impact anomaly/investigation.