Commit Graph

13 Commits

Author SHA1 Message Date
freemo 946ebdec66 fix(cli/session): add --format flag and JSON envelope output to session tell
Add BDD/Behave test scenarios for the existing --format/-f flag on `agents session tell`,
  and update CHANGELOG.md and CONTRIBUTORS.md.

  The implementation of --format on session tell exists in the codebase (commit 87a7ce35d),
  but lacks dedicated BDD test coverage. This PR adds:

  - 6 new Behave scenarios in features/session_cli.feature testing JSON, YAML, plain, table,
    short flag (-f), and Rich output regression paths
  - 6 corresponding step definitions in features/steps/session_cli_steps.py verifying
    spec-compliant JSON envelopes, valid YAML/JSON output, ASCII table output, and Rich console
    content preservation
  - CHANGELOG.md entry under [Unreleased] documenting the --format flag feature
  - CONTRIBUTORS.md entry crediting Jeffrey Phillips Freeman

  Quality gates: lint ✓, typecheck ✓ (only pre-existing warnings about optional provider imports)

  ISSUES CLOSED: #10466
2026-06-14 13:23:57 -04:00
HAL9000 c0606ce0ce fix(cli): handle --format color in session delete as Rich output
The delete command's output branch used `fmt == OutputFormat.RICH` which
caused --format color to emit a JSON envelope instead of Rich panels.
Align with all other session commands by checking
`fmt not in (OutputFormat.RICH, OutputFormat.COLOR)` for machine-readable
paths. Add BDD scenario and step for --format color to close the coverage gap.

ISSUES CLOSED: #6457
2026-05-31 19:27:43 -04:00
HAL9000 b1bfaf032e fix(cli): fix JSON/YAML envelope messages[].text for delete/export/import
Extend the JSON/YAML envelope messages[].text fix to cover the remaining
three session subcommands that were still producing plain Rich output
instead of structured envelopes for non-rich format paths:

- session delete: route non-rich formats through format_output() with
  messages=[{"level": "ok", "text": "Session deleted"}]
- session export: add --output-format/-f option; emit structured envelope
  with session_export/contents/integrity data and "Export completed" message
- session import: add --format/-f option; emit structured envelope with
  session_import/validation/merge data and "Import completed" message

Also add BDD scenarios to features/session_cli.feature for each new
envelope path, add corresponding step definitions, add CHANGELOG entry
under [Unreleased] Fixed, and assign milestone v3.2.0 to the PR.

ISSUES CLOSED: #6457
2026-05-31 19:27:43 -04:00
HAL9000 d785397da4 fix(cli): fix JSON/YAML envelope messages[].text to show actual content (#6457) 2026-05-31 19:27:43 -04:00
hurui200320 85c579b51f fix(cli): display full session IDs in session list output
CI / status-check (push) Blocked by required conditions
CI / benchmark-regression (push) Waiting to run
CI / push-validation (push) Successful in 36s
CI / helm (push) Successful in 45s
CI / build (push) Successful in 58s
CI / lint (push) Successful in 1m9s
CI / quality (push) Successful in 1m18s
CI / typecheck (push) Successful in 1m31s
CI / security (push) Successful in 1m36s
CI / e2e_tests (push) Successful in 3m42s
CI / unit_tests (push) Successful in 4m38s
CI / integration_tests (push) Successful in 4m51s
CI / coverage (push) Has started running
CI / docker (push) Successful in 1m30s
CI / benchmark-publish (push) Has started running
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 23s
CI / build (pull_request) Successful in 1m2s
CI / lint (pull_request) Successful in 1m11s
CI / quality (pull_request) Successful in 1m16s
CI / typecheck (pull_request) Successful in 1m24s
CI / security (pull_request) Successful in 1m38s
CI / benchmark-publish (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 4m36s
CI / unit_tests (pull_request) Successful in 4m48s
CI / benchmark-regression (pull_request) Failing after 1m23s
CI / docker (pull_request) Successful in 1m49s
CI / coverage (pull_request) Successful in 10m54s
CI / integration_tests (pull_request) Failing after 3m59s
CI / status-check (pull_request) Failing after 4s
Remove the [:8] truncation from session IDs in the Rich table row,
Most Recent summary, and Oldest summary fields of list_sessions()
and _session_list_dict().  Session IDs are 26-character ULIDs and
must be usable directly for copy-paste into session tell, session
show, and other session commands.  The structured output (JSON/YAML)
already used full IDs in the sessions[*].id field, but the summary
panel leaked the truncation into those formats as well.

Added Behave scenarios:
- Rich table displays full 26-character ULIDs (scoped to table region)
- Summary panel shows full ULIDs for unnamed sessions (scoped to panel)
- Summary panel shows session names for named sessions
- Full ULID from list output works with session tell (round-trip,
  uses parsed ULID, not hardcoded constant)

Review Cycle 2 fixes:
- docs/specification.md: Updated YAML output example to full ULIDs
- docs/showcase/*.md: Updated all example output blocks to full ULIDs
- docs/reference/session_cli.md: Replaced placeholder with full ULID
- features/session_cli.feature: Consecutive When steps -> And
- features/steps/session_cli_steps.py: Summary panel asserts both IDs,
  8-char negative guard in table output, ULID capture scoped to table
  region with fixture verification, named-session absence check for
  second session
- CHANGELOG.md: Added [Unreleased] entry for the behavioral change

ISSUES CLOSED: #10970
2026-05-05 10:56:18 +00:00
HAL9000 f2b60cc3d6 fix(cli): restore session list json contract
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 35s
CI / push-validation (pull_request) Successful in 21s
CI / build (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m0s
CI / quality (pull_request) Successful in 1m33s
CI / security (pull_request) Successful in 1m45s
CI / typecheck (pull_request) Successful in 1m49s
CI / integration_tests (pull_request) Successful in 3m58s
CI / e2e_tests (pull_request) Successful in 4m32s
CI / unit_tests (pull_request) Successful in 5m55s
CI / docker (pull_request) Successful in 1m31s
CI / coverage (pull_request) Successful in 10m47s
CI / status-check (pull_request) Successful in 3s
CI / build (push) Successful in 47s
CI / lint (push) Successful in 57s
CI / helm (push) Successful in 28s
CI / quality (push) Successful in 1m11s
CI / typecheck (push) Successful in 1m34s
CI / security (push) Successful in 1m36s
CI / push-validation (push) Successful in 21s
CI / benchmark-publish (push) Failing after 40s
CI / integration_tests (push) Successful in 3m47s
CI / e2e_tests (push) Successful in 4m9s
CI / unit_tests (push) Successful in 7m0s
CI / docker (push) Successful in 1m31s
CI / coverage (push) Successful in 10m40s
CI / status-check (push) Successful in 3s
Ensure the session list helper only emits the documented fields so downstream consumers stay compliant, and tighten the Behave coverage to enforce the contract.\n\nISSUES CLOSED: #6436
2026-04-26 19:40:00 +00:00
HAL9000 b92f0270c2 fix(cli): fix session show/list JSON output to not redact input messages (#6436)
ISSUES CLOSED: #6436
2026-04-26 19:40:00 +00:00
freemo 54285e0f33 fix(cli): correct session show rich output Session Summary panel field labels and fields
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / security (push) Waiting to run
CI / quality (push) Waiting to run
CI / unit_tests (push) Waiting to run
CI / integration_tests (push) Waiting to run
CI / e2e_tests (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / benchmark-regression (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions
CI / helm (push) Waiting to run
CI / status-check (push) Blocked by required conditions
Reviewed and APPROVED. Closes #3040.
2026-04-05 21:12:13 +00:00
freemo e4493e8978 fix(cli): correct session show rich output Session Summary panel field labels and fields
CI / lint (pull_request) Successful in 21s
CI / typecheck (pull_request) Successful in 52s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 1m8s
CI / build (pull_request) Successful in 29s
CI / helm (pull_request) Successful in 22s
CI / unit_tests (pull_request) Failing after 6m49s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m4s
CI / integration_tests (pull_request) Failing after 22m47s
CI / coverage (pull_request) Successful in 10m57s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m8s
Fixes three deviations from docs/specification.md in the agents session show
rich output Session Summary panel:

1. Renamed 'Session ID:' label to 'ID:' to match spec exactly.
2. Removed 'Namespace:' field which is not part of the spec.
3. Added 'Automation:' field sourced from session.metadata['automation_profile'],
   defaulting to '(none)' when not set.
4. Field order now matches spec: ID → Actor → Messages → Created → Updated → Automation.

Updated features/session_cli.feature to assert the corrected field labels are
present ('ID:', 'Actor:', 'Messages:', 'Created:', 'Updated:', 'Automation:')
and that the removed fields ('Session ID:', 'Namespace:') are absent.

Added 'the session CLI output should not contain' step definition to
features/steps/session_cli_steps.py to support the new negative assertions.

ISSUES CLOSED: #3040
2026-04-05 19:44:08 +00:00
freemo 34f773c90a fix(cli): add spec-required Session Export, Contents, and Integrity panels to agents session export
CI / lint (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 51s
CI / quality (pull_request) Successful in 33s
CI / security (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 24s
CI / unit_tests (pull_request) Failing after 6m52s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 16m23s
CI / integration_tests (pull_request) Failing after 23m3s
CI / coverage (pull_request) Successful in 10m45s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m43s
Implements the three Rich panels required by specification.md §"agents session export"
(lines 1987–2115) that were missing from the export_session() command.

Changes:
- Add _render_export_panels() helper that renders three spec-required panels:
  * "Session Export" panel: session ID, output path, message count, file size, format
  * "Contents" panel: messages, plan references, metadata keys, actor config, schema version
  * "Integrity" panel: checksum (sha256:xxxx...xxxx), encrypted flag
- Fix success message from "Session exported to {output}" to "Export completed"
- Fix stdout export path to also render Rich panels (previously only printed raw JSON)
- Keep --format and --force options (useful extensions, do not break spec compliance)
- Update Behave scenarios in features/session_cli.feature to verify panel rendering
- Update Robot Framework helper and test file with new export panel assertions

ISSUES CLOSED: #3424
2026-04-05 18:09:31 +00:00
freemo b82a9b6962 fix(cli): add spec-required Validation and Merge panels and correct title/message in agents session import (#3460)
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / security (push) Waiting to run
CI / quality (push) Waiting to run
CI / unit_tests (push) Waiting to run
CI / integration_tests (push) Waiting to run
CI / e2e_tests (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / benchmark-regression (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions
CI / helm (push) Waiting to run
CI / status-check (push) Blocked by required conditions
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-05 18:08:09 +00:00
freemo 02250473ad fix(ci): restore all CI quality gates to passing on master
Fix all failing CI quality gates (lint, unit_tests, format) without
suppressing any quality enforcement.

Root causes and fixes:

1. Format: features/steps/plan_namespaced_name_tdd_steps.py had trailing
   whitespace; fixed by running ruff format.

2. Unit tests - A2A JSON-RPC 2.0 migration (commit 9c6d6915) renamed
   A2aRequest fields (operation→method, request_id→id, a2a_version→jsonrpc)
   and A2aResponse fields (status+data→result, request_id→id) but did not
   update all step files and feature files:
   - a2a_jsonrpc_wire_format_steps.py: added use_step_matcher('re') and
     reset to 'parse' at end to prevent parallel test interference
   - a2a_facade_wiring_steps.py: updated operation= to method=, .status/.data
     to .result
   - a2a_facade_steps.py: updated request_id→id, a2a_version→jsonrpc,
     A2aResponse(request_id=..., status=...) to new API
   - m6_facade_steps.py: updated all old API usage
   - devcontainer_cleanup_steps.py: updated A2aRequest(operation=...)
   - plan_prompt_command_steps.py: updated A2aRequest(operation=...)
   - wf03_plan_prompt_confidence_steps.py: updated A2aRequest(operation=...)
   - consolidated_misc.feature: updated old A2aRequest/A2aResponse scenarios

3. Unit tests - Session CLI output changed (commit 0d5d9cf0 and others):
   - 'Session Created' → 'Session created' (lowercase)
   - 'Session Details' → 'Session Summary'
   - 'Sessions (N total)' → 'Sessions'
   - session list JSON: top-level 'total' → nested 'summary.total'
   - Fixed in: session_cli.feature, session_cli_coverage_boost.feature,
     session_cli_uncovered_branches.feature, session_list_error.feature,
     tdd_session_create_persist_steps.py

4. Unit tests - Plan list output changed (commit 1a07a891):
   - 'V3 Lifecycle Plans' → 'Plans'
   - 'Lifecycle Plans' → 'Plans'
   - Name column removed (restored in source)
   - Invariants column removed (restored in source)
   - Project truncation removed (restored in source)
   - Fixed in: plan_cli_cancel_revert_coverage.feature,
     plan_lifecycle_cli_coverage.feature, plan_cli_coverage_boost_steps.py,
     plan.py (source code restored)

5. Unit tests - Plan apply command now requires ULID (commit 300a5d6d):
   - plan_cli_coverage_r3.feature: updated 'PLAN-001' to valid ULID
   - plan_cli_coverage_r3_steps.py: added --yes flag, added new step for
     no-eligible-plans path

6. Unit tests - Various source code bugs:
   - ThoughtBlock: converted from @dataclass to Pydantic BaseModel
     (architecture test requires all dataclasses to use Pydantic)
   - session.py: added DatabaseError handling to export, import, tell commands
   - database.py: fixed rollback_to() to reuse checkpoint connection for writes
   - database.py: added _get_checkpoint_conn() helper
   - check-tls-cert.py: fixed SSLCertVerificationError.reason AttributeError

7. Unit tests - Test step bugs:
   - error_recovery_coverage_boost_steps.py: fixed invalid ULID _PLAN_ID
   - session_service_coverage_steps.py: fixed 'sha256:' prefix bug in checksum
   - database_models_new_coverage_steps.py: added 'name' field to session mock
   - async_audit_recording_steps.py: fixed Settings(audit_async=False) via env var
   - coverage_threshold_config_steps.py: added --coverage-min pattern support
   - m5_acms_smoke_steps.py: updated usage hint text
   - actor_cli_yaml_steps.py: updated 'Removed actor' → 'Actor removed'
   - aimodelscredentials_steps.py: set context.imported_class in import step
   - domain_base_model.feature: added missing 'When I examine model_config' step
   - tui_first_run_steps.py: fixed module reload to restore cleveragents.tui.*
     modules after test (prevented patch interference in subsequent tests)
   - tui_first_run_steps.py: added set_search('') step for empty string
   - resource_handler_base_coverage_r3_steps.py: use _MinimalHandler instead
     of DatabaseResourceHandler for NotImplementedError tests
   - resource_handler_crud.feature: updated to test new DatabaseHandler behavior
   - resource_handler_sandbox.feature: updated to test new DatabaseHandler behavior
   - tdd_json_decode_crash_persistence.feature: fixed @tdd_bug → @tdd_issue tags

8. Parallel test interference:
   - All step files using use_step_matcher('re') now reset to 'parse' at end
     to prevent global matcher state leaking to subsequent step files
2026-04-04 20:38:16 +00:00
brent.edwards 04c8a886db feat(cli): add session commands 2026-02-20 01:10:19 +00:00