Skip to content

feat(observability): add recording trajectory bundles (#1059)#1117

Open
shaun0927 wants to merge 1 commit into
developfrom
feat/1059-cua-adoption
Open

feat(observability): add recording trajectory bundles (#1059)#1117
shaun0927 wants to merge 1 commit into
developfrom
feat/1059-cua-adoption

Conversation

@shaun0927
Copy link
Copy Markdown
Owner

Closes #1059.

Directionality / overlap check

  • Default-off observability only: trajectory capture is enabled only through oc_recording_start({ trajectoryBundle: true }).
  • No server-side agent loop, LLM policy, retry, recovery, or browser action is introduced.
  • Uses the existing recording lifecycle rather than adding a competing trajectory lifecycle tool.
  • Checked current open PRs before implementation; no open PR adds a trajectory bundle writer or recording-linked episode artifact surface.

Summary

  • Adds a file-based trajectory bundle writer under src/trajectory/.
  • Links recording actions, oc_assert contract results, and oc_checkpoint saves into append-only bundle artifacts.
  • Adds oc_recording_status to expose active trajectory metadata while recording is running.
  • Finalizes report.json on oc_recording_stop with event, tool, failure, contract, and artifact counts.
  • Bounds event summaries to 4 KiB and redacts password/token/secret/credential/api-key style fields.
  • Keeps all trajectory writes best-effort so storage failures do not fail the original MCP tool call.

Verification

  • npm test -- --runInBand tests/recording/action-recorder-trajectory.test.ts tests/tools/recording.test.ts tests/recording/action-recorder.bounds.test.ts tests/tools/oc-assert.recorder-wiring.test.ts
  • npm run lint:changed
  • npm run build
  • npm test -- --runInBand tests/cross-env/cursor-verification.test.ts (suite is skipped in this environment)

Merge-after validation with OpenChrome

  1. Start OpenChrome, connect Chrome, then run oc_recording_start with { "trajectoryBundle": true }.
  2. Navigate to https://example.com, call read_page, run one passing oc_assert, save an oc_checkpoint, run one failing oc_assert, then call oc_recording_stop.
  3. Verify the returned trajectory directory contains meta.json, events.jsonl, contracts/, checkpoints/, and report.json.
  4. Verify sequence order with: jq -r '.seq' ~/.openchrome/trajectories/<id>/events.jsonl | awk 'NR>1 && $1<=prev { exit 1 } { prev=$1 }'.
  5. Verify report.json.contracts.pass === 1, report.json.contracts.fail === 1, and checkpoint/contract artifact counts are non-zero.
  6. Type fixture secret super-secret-fixture-password during a recorded run and verify ! grep -R "super-secret-fixture-password" ~/.openchrome/trajectories/<id>.
  7. Start/stop a normal recording without trajectoryBundle:true; verify no new trajectory directory is created.

Not tested

  • Live browser smoke was not run in this worktree; deterministic unit/integration coverage validates the file layout, ordering, linking, report, and redaction behavior.

Constraint: Episode trajectory capture must remain default-off and observability-only so OpenChrome tool behavior does not change for normal sessions.\nRejected: A separate trajectory lifecycle tool | recording already owns episode lifecycle and a second control surface would add wandering/confusion.\nConfidence: medium\nScope-risk: moderate\nDirective: Keep trajectory writes best-effort and bounded; do not add recovery, retry, or LLM policy decisions to this core writer.\nTested: npm test -- --runInBand tests/recording/action-recorder-trajectory.test.ts tests/tools/recording.test.ts tests/recording/action-recorder.bounds.test.ts tests/tools/oc-assert.recorder-wiring.test.ts; npm run lint:changed; npm run build; npm test -- --runInBand tests/cross-env/cursor-verification.test.ts\nNot-tested: Live OpenChrome browser run with real oc_assert/oc_checkpoint artifacts
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

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