feat: add line number and context to stepping tool responses#9
Conversation
Enhanced step_over, step_into, and step_out tools to return current
location (file, line, column) and surrounding source code context,
similar to set_breakpoint response format.
This improves UX for AI agents who don't have visual debuggers by
providing immediate feedback about where execution stopped after
each step operation.
Changes:
- SessionManager: Modified _executeStepOperation to capture current
location from stack trace after stopped event
- Server: Updated step methods to return full DebugResult with
location and use LineReader to add source context
- Tests: Updated E2E smoke tests to verify location and context
fields are present in step responses
Response format now includes:
{
success: true,
message: "Stepped over",
state: "paused",
location: { file: "...", line: 42, column: 0 },
context: {
lineContent: "current line source",
surrounding: [{ line: 40, content: "..." }, ...]
}
}
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public async stepOver(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> { | ||
| this.validateSession(sessionId); | ||
| const result = await this.sessionManager.stepOver(sessionId); | ||
| if (!result.success) { | ||
| throw new Error(result.error || 'Failed to step over'); | ||
| } | ||
| return true; | ||
| return result; | ||
| } | ||
|
|
||
| public async stepInto(sessionId: string): Promise<boolean> { | ||
| public async stepInto(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> { | ||
| this.validateSession(sessionId); | ||
| const result = await this.sessionManager.stepInto(sessionId); | ||
| if (!result.success) { | ||
| throw new Error(result.error || 'Failed to step into'); | ||
| } | ||
| return true; | ||
| return result; | ||
| } | ||
|
|
||
| public async stepOut(sessionId: string): Promise<boolean> { | ||
| public async stepOut(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> { | ||
| this.validateSession(sessionId); | ||
| const result = await this.sessionManager.stepOut(sessionId); | ||
| if (!result.success) { | ||
| throw new Error(result.error || 'Failed to step out'); | ||
| } | ||
| return true; | ||
| return result; |
There was a problem hiding this comment.
Step API now returns DebugResult but callers still expect boolean
The three stepping methods now return the full DebugResult object rather than a boolean, but the rest of the codebase still calls them as booleans. For example tests/test-utils/helpers/session-helpers.ts exports stepOver/stepInto/stepOut as Promise<boolean> and simply forwards the server result, and unit tests such as tests/unit/server-coverage.test.ts assert await expect(server.stepOver(...)).resolves.toBe(true). After this change those calls will resolve to an object, so the existing tests and any consumers will fail immediately. Either the return types need to remain boolean or all callers and type signatures must be updated in the same change.
Useful? React with 👍 / 👎.
Step methods (stepOver, stepInto, stepOut) now return the full DebugResult object instead of boolean, so tests need to expect the object structure.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
Enhanced step_over, step_into, and step_out tools to return current location (file, line, column) and surrounding source code context, similar to set_breakpoint response format.
This improves UX for AI agents who don't have visual debuggers by providing immediate feedback about where execution stopped after each step operation.
Changes:
Response format now includes:
{
success: true, message: "Stepped over", state: "paused", location: { file: "...", line: 42, column: 0 }, context: { lineContent: "current line source", surrounding: [{ line: 40, content: "..." }, ...] } }
📋 Description
Please include a summary of the changes and which issue is fixed. Include relevant motivation and context.
Fixes # (issue number)
🔄 Type of Change
Please delete options that are not relevant.
✅ Checklist
🧪 Testing
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Test Configuration:
📸 Screenshots (if applicable)
If your changes include UI updates or visual debugging improvements, please add screenshots.
🔗 Related Issues
Link any related issues here:
📝 Additional Notes
Any additional information that reviewers should know.
Reviewer: @debugmcp